1. Uptime Command

Uptime command, in Linux, displays the running time for your system and the number of users are currently logged in and also displays load average for 1,5 and 15 minutes intervals.

# uptime

08:16:26 up 22 min, 1 user, load average: 0.00, 0.03, 0.22

Check Uptime Version

Except uptime and version, uptime command doesn’t have other options. if it is less than 1 day, then it provides information in hours:mins only.

[tecmint@tecmint ~]$ uptime -V

procps version 3.2.8

  1. W Command

This command will display users who are logged in currently, shows their process and also load averages. It also displays the remote host, tty name, login time, idle time, login name, PCPU, JCPU, processes and commands.

# w

08:27:44 up 34 min, 1 user, load average: 0.00, 0.00, 0.08

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

tecmint  pts/0    192.168.50.1     07:59    0.00s  0.29s  0.09s w

Options in hand

-h : displays no header entries.

-s : without JCPU and PCPU.

-f : Removes from field.

-V : (upper letter) – Shows versions.

  1. Users Command

Users command shows the users who are logged in currently. Help and version are the only parameters, users command has.

# users

tecmint

  1. Who Command

who command gives back user name, time, date and host information. This command is much likely w command. What users do is not printed by who command which is unlikely to W command. Let’s distinguish between W command and Who command by illustrating.

# who

tecmint  pts/0        2012-09-18 07:59 (192.168.50.1)

# w

08:43:58 up 50 min,  1 user,  load average: 0.64, 0.18, 0.06

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

tecmint  pts/0    192.168.50.1     07:59    0.00s  0.43s  0.10s w

Who command Options

-b : Displays last system reboot date and time.

-r : Shows current runlet.

-a, –all : Displays all information in cumulatively.

  1. Whoami Command

The current user’s name is printed by whoami command. “who am i” command can also be used for displaying the current user. Whenever you log in as root using sudo command, then “whoami” command can then provide you the detail for the specific number of users logging in the system.

# whoami

tecmint

  1. ls Command

The use of Is command is to show the files’ list in the format which is readable by humans.

# ls -l

total 114

dr-xr-xr-x.   2 root root  4096 Sep 18 08:46 bin

dr-xr-xr-x.   5 root root  1024 Sep  8 15:49 boot

Sort file in the same way as modified last time.

# ls -ltr

total 40

-rw-r–r–. 1 root root  6546 Sep 17 18:42 install.log.syslog

-rw-r–r–. 1 root root 22435 Sep 17 18:45 install.log

-rw——-. 1 root root  1003 Sep 17 18:45 anaconda-ks.cfg

  1. Crontab Command

With the help of Crontab command and I options, one can make a list of the jobs scheduled of the current users.

# crontab -l

00 10 * * * /bin/ls >/ls.txt

Edit your crontab with -e option. In the below example will open schedule jobs in VI editor. Make a necessary changes and quit pressing :wq keys which saves the setting automatically.

# crontab -e

  1. Less Command

less command lets you view files quickly. All you can do this is by clicking page up or page down keys. And, then to quit, all you need to press is ‘q’ key from the less window.  

# less install.log

Installing setup-2.8.14-10.el6.noarch

warning: setup-2.8.14-10.el6.noarch: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY

Installing filesystem-2.4.30-2.1.el6.i686

Installing ca-certificates-2010.63-3.el6.noarch

Installing xml-common-0.6.3-32.el6.noarch

Installing tzdata-2010l-1.el6.noarch

Installing iso-codes-3.16-2.el6.noarch

  1. More Command

more command lets a programmer view files promptly and display the details in the form of percentage. Similarly, you can use page up and page down keys for more command as well and quit the more command window by pressing ‘q’ key.

# more install.log

Installing setup-2.8.14-10.el6.noarch

warning: setup-2.8.14-10.el6.noarch: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY

Installing filesystem-2.4.30-2.1.el6.i686

Installing ca-certificates-2010.63-3.el6.noarch

Installing xml-common-0.6.3-32.el6.noarch

Installing tzdata-2010l-1.el6.noarch

Installing iso-codes-3.16-2.el6.noarch

–More–(10%)

  1. CP Command

Copy file from source to destination preserving same mode.

# cp -p fileA fileB

You will be prompted before overwrite to file.

# cp -i fileA fileB