How to create text file, using Linux cat command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   How to create text file on Linux Fedora system???... There is lot of text editor in Linux that you can use to create text files, but the easers one to create text file is with the cat command.  The cat command or concatenate can be use to create text file or displaying them on Linux system.  The cat command example below, show the step by step to use the cat command to create text file

1.  cat Command Example:

                                                     |  redirect the output to...

                                                     \                        | new text file name

[root@fedora ~]# cat > text_file_example.txt 

This is my new text file

This is Linux text file

Create text file and ...

this is the last line...

                         <---------Push Ctrl+D key here

[root@fedora ~]#

create text file on linux using cat command

[root@fedora ~]# cat > text_file_example.txt

This is my new text file

This is Linux text file

Create text file and ...

this is the last line...

 

[root@fedora ~]#

 

2.  Verify the cat Command output:

view text file on linux using cat command

still use the cat command but no > redirect sign

[root@fedora ~]# cat text_file_example.txt

This is my new text file

This is Linux text file

Create text file and ...

this is the last line...

 

[root@fedora ~]#

 




View current date and time using date command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The date command can be use to display current date and time on your Linux system.  The command example below show the use of date command to display current date and time on the system.

1. date Command Example:

[root@fedora ~]#  date 

 

2.  date Command output:

display current date and time on Linux using date command

[root@fedora ~]# date

Tue Jul 29 01:36:51 EDT 2008

[root@fedora ~]#

 

Help and manual for date command:

[root@fedora ~]# man date

[root@fedora ~]# info date

[root@fedora ~]# date --help

 




View date and time on Linux using hwclock command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The hwclock can be use to view date and time of Linux machine base on hardware clock on the machine.  The hwclock command example below show the execution of hwclock command on Fedora Linux machine.

1.   Enter hwclock command with --show option on the terminal and then hit Enter button.

show date and time on Linux computer

[root@fedora ~]# hwclock --show

Mon 28 Jul 2008 05:52:44 AM EDT -0.774486 seconds 

[root@fedora ~]# 

 

The output from the hwclock command display the current date and time on Linux computer base on the hardware setting.. that set on the Bios...

 




Extract tar.bz2 file or open tar.bz2 file using tar command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The tar command can be use to open or extract tar.bz2 file.  The example below show step by step to extract the tar.bz2 file and then view inside the extract folder.

1.  The example below show the tar command with option xvjf is use to extract the tar.bz2 file..

# tar xvjf 

      x      <-- x = extract -->

       v     <-- v = verbose -->

        j    <-- j = bzip2 -->

         f   <-- f = file -->

extract tar tz2 file

[root@fedora ~]# tar xvjf sysreport-fedora.gnulinux.com3716.tar.bz2

sysreport-fedora.gnulinux.com3716/

sysreport-fedora.gnulinux.com3716/lsmod

sysreport-fedora.gnulinux.com3716/date

sysreport-fedora.gnulinux.com3716/lsof

sysreport-fedora.gnulinux.com3716/var/

sysreport-fedora.gnulinux.com3716/var/log/

sysreport-fedora.gnulinux.com3716/var/log/rpmpkgs

sysreport-fedora.gnulinux.com3716/var/log/messages

sysreport-fedora.gnulinux.com3716/var/log/maillog

sysreport-fedora.gnulinux.com3716/var/log/Xorg.0.log

sysreport-fedora.gnulinux.com3716/var/log/maillog-20080720

sysreport-fedora.gnulinux.com3716/var/log/messages-20080710

sysreport-fedora.gnulinux.com3716/var/log/httpd/

sysreport-fedora.gnulinux.com3716/var/log/httpd/modsec_debug.log

sysreport-fedora.gnulinux.com3716/var/log/httpd/modsec_audit.log

sysreport-fedora.gnulinux.com3716/var/log/dmesg

sysreport-fedora.gnulinux.com3716/var/log/boot.log

sysreport-fedora.gnulinux.com3716/var/log/maillog-20080714

sysreport-fedora.gnulinux.com3716/var/log/messages-20080720

sysreport-fedora.gnulinux.com3716/var/log/messages-20080714

sysreport-fedora.gnulinux.com3716/var/log/maillog-20080710

sysreport-fedora.gnulinux.com3716/var/log/messages-20080703

^C

[root@fedora ~]#

 

2.  Use the ll command to view the extracted tar.bz2 file / folder

list extracted bz2 file

[root@fedora ~]# ll

total 628

-rw------- 1 root root 3658 2008-05-20 08:26 anaconda-ks.cfg

drwxr-xr-x 6 root root 4096 2008-07-23 05:06 Desktop

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Documents

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Download

drwxr-xr-x 2 root root 4096 2008-05-20 15:53 fedora9

-rw-r--r-- 1 root root 72032 2008-05-20 08:25 install.log

-rw-r--r-- 1 root root 9766 2008-05-20 08:14 install.log.syslog

-rw------- 1 root root 5247 2008-07-08 04:28 mbox

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Music

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Pictures

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Public

drwx------ 7 root root 4096 2008-07-27 04:32 sysreport-fedora.gnulinux.com3716

-rw------- 1 root root-07-27 04:40 sysreport-fedora.gnulinux.com3716.tar.bz2

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Templates

drwxr-xr-x 2 root root 4096 2008-05-20 08:55 Videos

[root@fedora ~]#

 

3.  Enter to the extracted directory using the cd command, and then execute the ls command to list all the file inside the directory.

view inside the bz2 folder

[root@fedora ~]# cd sysreport-fedora.gnulinux.com3716

[root@fedora sysreport-fedora.gnulinux.com3716]# ls

boot df free ipcs lshal lspci mdadm proc route sysreport.log var

chkconfig etc hostname lib lsmod ls-samba modinfo ps sestatus uname wbinfo

date fdisk-l ifconfig ls-boot lsof lsusb mount pstree sysctl uptime

[root@fedora sysreport-fedora.gnulinux.com3716]#

 




Check System Configuration and Hardware Information on Linux Fedora using sysreport Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The system configuration and hardware information in Linux Fedora can be collect and view using the sysreport utillity.  The sysreport command can be executed to collect all the information, setting, including the hardware information for Fedora Linux system.  The command example below show the step by step execution of sysreport command.

sysreport Command Example:

# sysreport 

# sysreport -norpm 

# cp /tmp/sysreport-fedora.gnulinux.com3716.tar.bz2 ./

 

1.  Open the shell prompt then type in sysreport or sysreport -normp, then hit the Enter key.

sysreport command

[root@fedora ~]# sysreport

 

This utility will go through and collect some detailed information

about the hardware and setup of your Fedora Core system.

This information will be used to diagnose problems with your system

and will be considered confidential information. Red Hat will use

this information for diagnostic purposes ONLY.

 

Please wait while we collect information about your system.

 

This process may take a while to complete....

No changes will be made to your system during this process.

 

NOTE: You can safely ignore a failed message. This only means a file

we were checking for did not exist.

 

If your system hangs while gathering rpm information, please abort

the script with CTRL-C and run it again after adding -norpm to the

sysreport command line

 

Press ENTER to continue, or CTRL-C to quit.   <- hit Enter key here

 

Getting system configuration information.

 

Determining Fedora Core version: [ OK ]

Determinding your current hostname: [ OK ]

Getting the date: [ OK ]

Checking your systems current uptime and load average: [ OK ]

Checking available memory: [ OK ]

Checking free disk space: [ OK ]

Checking currently running processes: [ OK ]

Checking current process tree: [ OK ]

Collecting information about ld.so.conf: [ OK ]

Collecting information about ld.so.conf.d: [ OK ]

Collecting IPC-related information: [ OK ]

Collecting information about chkconfig --list: [ OK ]

Collecting information about /etc/rc.d: [ OK ]

Lists information about files opened (lsof) [ OK ]

Collecting interprocess communication facilities status [ OK ]

Collecting interprocess communication facilities status [ OK ]

Collecting information about currently installed packages:

This may take several minutes.... [ OK ]

Collecting information about the boot process (grub.conf): [ OK ]

Collecting information about the boot process (grub.map): [ OK ]

Collecting init configuration: [ OK ]

Collecting information about X: [ OK ]

Gathering sysctl information (/proc/sys): [ OK ]

Gathering sysctl information (/etc/sysctl.conf): [ OK ]

Collecting information about cron (cron.d): [ OK ]

Collecting information about cron (cron.daily): [ OK ]

Collecting information about cron (cron.deny): [ OK ]

Collecting information about cron (cron.hourly): [ OK ]

Collecting information about cron (cron.monthly): [ OK ]

Collecting information about cron (cron.weekly): [ OK ]

Collecting information about cron (crontab): [ OK ]

Gathering ntp configuration (/etc/ntp.conf): [ OK ]

Gathering ntp configuration (/etc/ntp/step-tickers): [ OK ]

Gathering ntp configuration (/etc/ntp/ntpservers): [ OK ]

Gathering IP information (/sbin/ifconfig): [ OK ]

Checking network routes: [ OK ]

Collecting Name Service Switch config information: [ OK ]

Collecting NIS client information: [ OK ]

Collecting system configuration information: [ OK ]

Collecting information about system authentication (pam): [ OK ]

 

Getting information about the kernel.

 

Getting kernel version: [ OK ]

Checking module information: [ OK ]

Checking module information bridge: [ OK ]

Checking module information bnep: [ OK ]

Checking module information rfcomm: [ OK ]

Checking module information l2cap: [ OK ]

Checking module information bluetooth: [ OK ]

Checking module information ib_iser: [ OK ]

Checking module information rdma_cm: [ OK ]

Checking module information ib_cm: [ OK ]

Checking module information iw_cm: [ OK ]

Checking module information ib_sa: [ OK ]

Checking module information ib_mad: [ OK ]

Checking module information ib_core: [ OK ]

Checking module information ib_addr: [ OK ]

Checking module information iscsi_tcp: [ OK ]

Checking module information libiscsi: [ OK ]

Checking module information scsi_transport_iscsi: [ OK ]

Checking module information fuse: [ OK ]

Checking module information sunrpc: [ OK ]

Checking module information ipt_REJECT: [ OK ]

Checking module information nf_conntrack_ipv4: [ OK ]

Checking module information iptable_filter: [ OK ]

Checking module information ip_tables: [ OK ]

Checking module information ip6t_REJECT: [ OK ]

Checking module information xt_tcpudp: [ OK ]

Checking module information nf_conntrack_ipv6: [ OK ]

Checking module information xt_state: [ OK ]

Checking module information nf_conntrack: [ OK ]

Checking module information ip6table_filter: [ OK ]

Checking module information ip6_tables: [ OK ]

Checking module information x_tables: [ OK ]

Checking module information loop: [ OK ]

Checking module information dm_multipath: [ OK ]

Checking module information ipv6: [ OK ]

Checking module information ppdev: [ OK ]

Checking module information snd_ens1371: [ OK ]

Checking module information gameport: [ OK ]

Checking module information snd_rawmidi: [ OK ]

Checking module information snd_ac97_codec: [ OK ]

Checking module information ac97_bus: [ OK ]

Checking module information snd_seq_dummy: [ OK ]

Checking module information snd_seq_oss: [ OK ]

Checking module information parport_pc: [ OK ]

Checking module information snd_seq_midi_event: [ OK ]

Checking module information parport: [ OK ]

Checking module information snd_seq: [ OK ]

Checking module information floppy: [ OK ]

Checking module information snd_seq_device: [ OK ]

Checking module information snd_pcm_oss: [ OK ]

Checking module information snd_mixer_oss: [ OK ]

Checking module information snd_pcm: [ OK ]

Checking module information pcspkr: [ OK ]

Checking module information snd_timer: [ OK ]

Checking module information snd: [ OK ]

Checking module information soundcore: [ OK ]

Checking module information snd_page_alloc: [ OK ]

Checking module information pcnet32: [ OK ]

Checking module information mii: [ OK ]

Checking module information ac: [ OK ]

Checking module information button: [ OK ]

Checking module information i2c_piix4: [ OK ]

Checking module information BusLogic: [ OK ]

Checking module information i2c_core: [ OK ]

Checking module information sg: [ OK ]

Checking module information sr_mod: [ OK ]

Checking module information cdrom: [ OK ]

Checking module information dm_snapshot: [ OK ]

Checking module information dm_zero: [ OK ]

Checking module information dm_mirror: [ OK ]

Checking module information dm_mod: [ OK ]

Checking module information ata_generic: [ OK ]

Checking module information ata_piix: [ OK ]

Checking module information pata_acpi: [ OK ]

Checking module information libata: [ OK ]

Checking module information sd_mod: [ OK ]

Checking module information scsi_mod: [ OK ]

Checking module information ext3: [ OK ]

Checking module information jbd: [ OK ]

Checking module information mbcache: [ OK ]

Checking module information uhci_hcd: [ OK ]

Checking module information ohci_hcd: [ OK ]

Checking module information ehci_hcd: [ OK ]

Gathering information about your filesystems: [ OK ]

Gathering information about your system stat: [ OK ]

Gathering information about your partitions: [ OK ]

Gathering information about slabinfo: [ OK ]

Collecting information regarding kernel modules [ OK ]

Collecting information regarding kernel modules (modeprobe.[ OK ]

Getting kernel command line [ OK ]

Gathering information about your CPU: [ OK ]

Gathering information about your Ram: [ OK ]

Gathering information about your ioports: [ OK ]

Gathering information about your interrupts: [ OK ]

Gathering information about your scsi devices: [ OK ]

Gathering information about your dma: [ OK ]

Gathering information about your devices (/proc/devices): [ OK ]

Gathering information about your bus: [ OK ]

Gathering info on udev configuration: [ OK ]

 

Getting disk and filesystem information.

 

Collecting information from /etc/fstab: [ OK ]

Checking mounted file systems (mount) [ OK ]

Checking mounted file systems (/proc/mounts) [ OK ]

Collecting Software RAID information (/proc/mdstat) [ OK ]

Collecting Software RAID information (mdadm -D /dev/md*) [ OK ]

Gathering LVM setup [ OK ]

Collecting USB devices list (lsusb): [ OK ]

Collecting global devices list (lshal): [ OK ]

 

collecting information about commonly used network services

 

Collecting information from /etc/host.conf: [ OK ]

Collecting information from /etc/hosts: [ OK ]

Collecting information from /etc/hosts.allow: [ OK ]

Collecting information from /etc/hosts.deny: [ OK ]

Collecting information about the ftp servers (ftpusers): [ OK ]

Collecting information about the ftp servers (user_list): [ OK ]

Collecting information about the ftp servers (vsftpd.conf):[ OK ]

Collecting information about the ftp servers (vsftpd_conf_m[ OK ]h):

Collecting information about ypbind configuration: [ OK ]

Getting LDAP configuration (ldap.conf) [ OK ]

Getting LDAP configuration (ldap.conf) [ OK ]

Getting ssh configuration (ssh_config) [ OK ]

Getting sshd configuration (sshd_config) [ OK ]

Sendmail Configuration (/etc/mail/sendmail.cf): [ OK ]

Sendmail User aliases (/etc/aliases): [ OK ]

Getting files from (Makefile) [ OK ]

Getting files from (access) [ OK ]

Getting files from (domaintable) [ OK ]

Getting files from (helpfile) [ OK ]

Getting files from (local-host-names) [ OK ]

Getting files from (mailertable) [ OK ]

Getting files from (sendmail.cf) [ OK ]

Getting files from (sendmail.mc) [ OK ]

Getting files from (spamassassin) [ OK ]

Getting files from (submit.cf) [ OK ]

Getting files from (submit.mc) [ OK ]

Getting files from (trusted-users) [ OK ]

Getting files from (virtusertable) [ OK ]

Collecting Postfix Configuration (main.cf) [ OK ]

Collecting Postfix Configuration (master.cf) [ OK ]

Collecting exim configuration directory [ OK ]

Collecting host resolution information [ OK ]

Collecting information about the nameserver (named.conf) [ OK ]

Collecting information about the nameserver (/var/named) [ OK ]

Collecting information about the NFS: [ OK ]

Getting samba informations (lmhosts) [ OK ]

Getting samba informations (smb.conf) [ OK ]

Getting samba informations (smbusers) [ OK ]

Getting samba informations (wbinfo -g): [ OK ]

Getting samba informations (wbinfo -u): [ OK ]

Getting /etc/securetty [ OK ]

Getting /etc/shells [ OK ]

Getting ulimit info [ OK ]

Getting nscd configuration [ OK ]

Getting Kerberos informations (/etc/krb5.conf) [ OK ]

Getting information about apache [ OK ]

Getting information about apache (BackupPC.conf) [ OK ]

Getting information about apache (auth_kerb.conf) [ OK ]

Getting information about apache (auth_mysql.conf) [ OK ]

Getting information about apache (auth_pgsql.conf) [ OK ]

Getting information about apache (authz_ldap.conf) [ OK ]

Getting information about apache (awstats.conf) [ OK ]

Getting information about apache (drupal.conf) [ OK ]

Getting information about apache (fcgid.conf) [ OK ]

Getting information about apache (manual.conf) [ OK ]

Getting information about apache (mod_cband.conf) [ OK ]

Getting information about apache (mod_extract_forwarded.con[ OK ]

Getting information about apache (mod_geoip.conf) [ OK ]

Getting information about apache (mod_security.conf) [ OK ]

Getting information about apache (opendap_apache.conf) [ OK ]

Getting information about apache (perl-HTML-Mason.conf) [ OK ]

Getting information about apache (perl.conf) [ OK ]

Getting information about apache (php.conf) [ OK ]

Getting information about apache (phpldapadmin.conf) [ OK ]

Getting information about apache (proxy_ajp.conf) [ OK ]

Getting information about apache (python.conf) [ OK ]

Getting information about apache (squid.conf) [ OK ]

Getting information about apache (ssl.conf) [ OK ]

Getting information about apache (tiquit.conf) [ OK ]

Getting information about apache (webalizer.conf) [ OK ]

Getting information about apache (welcome.conf) [ OK ]

Getting information about apache (wordpress.conf) [ OK ]

Getting information about squid [ OK ]

Getting information about CUPS (/etc/cups/classes.conf) [ OK ]

Getting information about CUPS (/etc/cups/client.conf) [ OK ]

Getting information about CUPS (/etc/cups/cupsd.conf) [ OK ]

Getting information about CUPS (/etc/cups/pdftops.conf) [ OK ]

Getting information about CUPS (/etc/cups/printers.conf) [ OK ]

Getting information about CUPS (/etc/cups/snmp.conf) [ OK ]

Getting information about CUPS (/etc/cups/subscriptions.con[ OK ]

 

Gathering information from system logs

 

Collecting information from dmesg: [ OK ]

Collecting messages files (/var/log/messages) [ OK ]

Collecting messages files (/var/log/messages-20080703) [ OK ]

Collecting messages files (/var/log/messages-20080710) [ OK ]

Collecting messages files (/var/log/messages-20080714) [ OK ]

Collecting messages files (/var/log/messages-20080720) [ OK ]

Collecting maillog files (/var/log/maillog) [ OK ]

Collecting maillog files (/var/log/maillog-20080703) [ OK ]

Collecting maillog files (/var/log/maillog-20080710) [ OK ]

Collecting maillog files (/var/log/maillog-20080714) [ OK ]

Collecting maillog files (/var/log/maillog-20080720) [ OK ]

Collecting X logs (/var/log/Xorg.0.log) [ OK ]

Collecting information (/var/log/rpmpkgs) [ OK ]

Collecting information (/var/log/boot.log) [ OK ]

Collecting information (/var/log/secure) [ OK ]

Collecting log files from Apache [ OK ]

 

Getting information about RHN

 

Gathering information on SELinux setup

 

Collecting log files from RHN [ OK ]

 

Please enter your case number (if you have one):  .   <- hit Enter key here

 

Please send /tmp/sysreport-fedora.gnulinux.com3716.tar.bz2 to your support representative.

 

[root@fedora ~]#

 

2.  The sysreport program will generate and store the result of system configuration and hardware information in the compress file, usually end with .tar.bz2 in the /tmp directory.  Copy this result report to current directory, as shown on copy (cp command) example below.

Copy sysreport .tar.bz2 to current directory

[root@fedora ~]# cp /tmp/sysreport-fedora.gnulinux.com3716.tar.bz2 ./

[root@fedora ~]#

 

3.  To view the system configuration and hardware information open extract .tar.bz2 file (sysreport-fedora.gnulinux.com3716.tar.bz2) and then view the report file with your choice of text editor.

 




Create File with touch Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The easiest way to create new file ( empty text file or txt file) on Fedora Linux system is using touch command.  The touch command can be very useful to create new empty text file on Linux system. The touch command example below show the step to create empty text file on Fedora Linux system.

Create file with touch command example no.01:

 

1.  Create new file named text_file.txt

create file

[root@fedora ~]# touch text_file.txt

[root@fedora ~]#

 

2.  List file in current directory to verify the creation of new text_file.txt

list file

[root@fedora ~]# ls

anaconda-ks.cfg Download install.log.syslog Pictures text_file.txt

Desktop fedora9 mbox Public Videos

Documents install.log Music Templates

[root@fedora ~]#

 

3.  Using the ll command to view long list file properties.

list test file

[root@fedora ~]# ll text_file.txt

-rw-r--r-- 1 root root 0 2008-07-23 05:04 text_file.txt

[root@fedora ~]#

 

Create files  with touch command example no.02:

 

1.  Create 3 files on one go with touch command.

create empty file

[root@fedora ~]# touch text_files.txt new_files.txt file_example.txt

[root@fedora ~]#

 

2. Verify the files creation.

create text files

[root@fedora ~]# ls

anaconda-ks.cfg fedora9 mbox Public

Desktop file_example.txt Music Templates

Documents install.log new_files.txt text_files.txt

Download install.log.syslog Pictures Videos

[root@fedora ~]#

 

3.  Using the ll command to view long list files properties.

long list files properties

[root@fedora ~]# ll text_files.txt new_files.txt file_example.txt

-rw-r--r-- 1 root root 0 2008-07-23 05:00 file_example.txt

-rw-r--r-- 1 root root 0 2008-07-23 05:00 new_files.txt

-rw-r--r-- 1 root root 0 2008-07-23 05:00 text_files.txt

[root@fedora ~]#

 

touch Command Example:

# touch text_file.txt 

# touch text_file.txt new_files.txt file_example.txt 

 

Note: The ll command is equal to ls -l ( alias ll='ls -l --color=auto')

 




Change Linux Hostname with hostname Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The hostname command can be use to change host name on Linux machine.  The step by step command example below show the use of the hostname command to change Linux hostname.  The host name that change by the hostname command is not going to be permanent, the hostname is for temporary basis... the new hostname will be reset back to the original host name before we change the hostname... after the Linux machine rebooted.  To change hostname permanently... see this article on how to change Linux hostname permanently.

hostname Command Example:

# hostname 

# hostname [new hostname]

 

1.  Display current Linux hostname.

display linux hostname

[root@fedora ~]# hostname

fedora.linux.com

[root@fedora ~]#

 

2.  Change current Linux host name (fedora.linux.com) to new hostname new.hostname.com 

change linux hostname

[root@fedora ~]# hostname new.hostname.com

[root@fedora ~]# 

 

3.  Verify the hostname changes by execute the hostname command again

display hostname

[root@fedora ~]# hostname

new.hostname.com

[root@fedora ~]# 

 




Display Linux Hostname with hostname Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The host name of Linux machine can be retrieve / display using the hostname command.  The hostname command can be use to change host name or just display hostname.  The command example below show the use of hostname command to display the host name on Fedora Linux machine. 

Display hostname Command Example:

# hostname 

# hostname -v

 

1.  To display Linux hostname just enter the hostname command, and then hit the Enter key.

display Fedora hostname

[root@fedora ~]# hostname

fedora.linux.com

[root@fedora ~]#

 

2. The hostname command with the -v option display the machine host name on verbose mode.

display Linux hostname

[root@fedora ~]# hostname -v

gethostname()=`fedora.linux.com'

fedora.linux.com

[root@fedora ~]#

 




Display Memory Status in Linux Fedora using free Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   How much your Linux box consume your memory resources.  How many memory space are there available or free to use??? The free command can help you to to view memory resources or memory properties of your Linux box.  The step by step command example below use the free command to display memory status on Linux Fedora machine

free Command Example:

# free 

# free -t

# free -m

 

1.  Command free display the memory status on the system:

display free memory on Linux Fedora

[root@fedora ~]# free

            total     used    free  shared buffers   cached

Mem:       673164   182772  490392       0    9176   107860

-/+ buffers/cache:   65736  607428

Swap:      557048        0  557048

[root@fedora ~]#

 

2.  The free command below give total amount memory available on the system:

Total memory available on Linux Fedora system

[root@fedora ~]# free -t

            total     used     free  shared buffers cached

Mem:       673164   185012   488152       0    9400 109756

-/+ buffers/cache:   65856   607308

Swap:      557048        0   557048

Total:    1230212   185012  1045200

[root@fedora ~]#

 

3.  Display memory used and free memory in MB:

Display memory used and free memory in MB

[root@fedora ~]# free -m

            total   used   free  shared buffers cached

Mem:         1518    355   1162       0      15    164

-/+ buffers/cache:   176   1342

Swap:         543      0    543

[root@fedora ~]# 

 




Display Linux Partition Table with fdisk Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The partition table on Linux can be display using the fdisk command.  The fdisk command (or partition table manipulator command) can be use to make partition table on your hard disk... the command example below, show how to use the fdisk command to display list of partition table on Fedora Linux system.

fdisk Command Example:

# fdisk -l 

# fdisk -l /dev/sda

# fdisk 

 

1.  Output from fdisk command with -l option display partition table on the system:

Display Linux Fedora Partition Table

[root@fedora ~]# fdisk -l

 

Disk /dev/sda: 10.7 GB,bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00011e25

 

Device Boot Start End Blocks Id System

/dev/sda1 * 1 25 200781 83 Linux

/dev/sda2 260 8e Linux LVM

 

Disk /dev/dm-0: 9898 MB,bytes

255 heads, 63 sectors/track, 1203 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00000000

 

Disk /dev/dm-0 doesn't contain a valid partition table

 

Disk /dev/dm-1: 570 MB, 570425344 bytes

255 heads, 63 sectors/track, 69 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x30307800

 

Disk /dev/dm-1 doesn't contain a valid partition table

[root@fedora ~]#

 

2.  Display partition table for first hard disk

List of Partition Table on Fedora Linux

[root@fedora ~]# fdisk -l /dev/sda

 

Disk /dev/sda: 10.7 GB,bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00011e25

 

Device Boot Start End Blocks Id System

/dev/sda1 * 1 25 200781 83 Linux

/dev/sda2 260 8e Linux LVM

[root@fedora ~]#

 

3.  fdisk command without any option display the fdisk command usage:

fdisk command usage

[root@fedora ~]# fdisk

 

Usage: fdisk [-l] [-b SSZ] [-u] device

E.g.: fdisk /dev/hda (for the first IDE disk)

or: fdisk /dev/sdc (for the third SCSI disk)

or: fdisk /dev/eda (for the first PS/2 ESDI drive)

or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)

...

[root@fedora ~]#

 




Display Directory inode Number and Files inode Number using tree Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The tree command can be use to display list of directory and files in Linux system.  The tree command also can display directory inode number and files inode number, as shown on the tree command example below.

Command example:

 

Display List of files and directory with files inode number and directory inode number that locate under root directory:

tree command issue:

# tree -a -L 1 --inodes / 

 

tree command output:

tree command display files and directory inodes

 

[root@fedora ~]# tree -a -L 1 --inodes / 

/

|-- [ 24529] .autofsck

|-- [ 310689] bin

|-- [ 2] boot

|-- [ 219] dev 

|-- [ 384273] etc

|-- [ 425153] home 

|-- [ 16353] lib

|-- [ 11] lost+found

|-- [ 179873] media

|-- [ 318865] mnt

|-- [ 515089] opt

|-- [ 1] proc

|-- [ 343393] root

|-- [ 24530] sbin

|-- [ 1] selinux

|-- [ 392449] srv

|-- [ 1] sys

|-- [ 261633] tmp

|-- [ 204401] usr

`-- [ 408801] var

 

19 directories, 1 file

[root@fedora ~]#

 




Display System Information on Linux Machine using uname Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The uname command can be use to display the Linux machine system information.  The example below show the execution of uname command and the output from the uname command that show current system information on the Linux system.

uname command example:

Display Linux System Information with uname command

 

[root@fedora ~]# uname -a

Linux fedora.linux.com 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41 EDT 2008 i686 i686 i386 GNU/Linux

[root@fedora ~]#

 

Output from the example of uname command above display the system information on:

 

Linux machine kernel name:  Linux

Linux machine network node hostname:  fedora.linux.com

Linux machine kernel release:  2.6.25-14.fc9.i686

Linux machine kernel version:  #1 SMP Thu May 1 06:28:41 EDT 2008

Linux machine hardware name:  i686

Linux machine processor type:  i686

Linux machine hardware platform:  i386

Linux machine operating system:  GNU/Linux

 




Install RPM Software on Linux Fedora 9



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The procedure below show step by step example to install rpm software package that have the dot rpm extension (.rpm) on Linux Fedora system.  The step show the use of RPM - RedHat Package Manager (RPM Package Manager)... to install VMwareTools-6.0.4-93057.i386.rpm package on Linux Fedora operating system.

Procedure:

 

1.  Locate the rpm file, usually end with the dot rpm extension (.rpm).

2.  Then execute the rpm -ivh command as shown on example below:

Install RPM software on Linux Fedora machine

 

[root@fedora VMware Tools]# ls

VMwareTools-6.0.4-93057.i386.rpm VMwareTools-6.0.4-93057.tar.gz

[root@fedora VMware Tools]# 

 

[root@fedora VMware Tools]# rpm -ivh VMwareTools-6.0.4-93057.i386.rpm 

Preparing... ########################################### [100%]

1:VMwareTools ########################################### [100%]

[root@fedora VMware Tools]#

 

rpm command explanation:

rpm - invoke the rpm command

 -i - install

  v - print verbose information

  h - print hash marks (#####)