Useful Linux Commands

1. Uptime Command

In Linux uptime command shows since how long your system is running 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



2. W Command

It will displays users currently logged in and their process

# 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
vpspro  pts/0    192.168.50.1     07:59    0.00s  0.29s  0.09s w


3. Users Command

Users command displays currently logged in users. 

# users
vpspro


4. Who Command

Who command return user namedatetime and host information.

# who
vpspro  pts/0        2017-09-18 07:59 (192.168.50.1)

5. Whoami Command

Whoami command print the name of current user.

# whoami
vpspro

6. ls Command

Ls command display list of files.

# ls -l
total 114
dr-xr-xr-x.   2 root root  4096 Sep 10 08:26 bin
dr-xr-xr-x.   5 root root  1024 Sep  8 12:59 boot

7. Crontab Command

List schedule jobs for current user with crontab command and -l option.
# crontab -l
00 10 * * * /bin/ls >/ls.txt


8. Less Command

Less command allows quickly view file. 

# 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


9. More Command

More command allows quickly view file and shows details in percentage.

# 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%)


10. CP Command

Command for copyng files.

# cp -p fileA fileB

11. MV Command

Rename fileA to fileB. -i options prompt before overwrite. 

# mv -i fileA fileB


12. Cat Command

Cat command used to view multiple file at the same time.

# cat fileA fileB


13. Cd command

With cd command (change directory) it will goes to fileA directory.

# cd /fileA


14. pwd command

Pwd command return with present working directory.

# pwd
/root

15. SSH Command (Secure Shell)

SSH command is used to login into remote host.

# ssh root@192.168.50.2

16. Free command

Free command shows free, total and swap memory information in bytes.

# free
total       used       free     shared    buffers     cached
Mem:       1030800     735944     294856          0      51648     547696
-/+ buffers/cache:     136600     894200
Swap:      2064376          0    2064376

17. Top Command

Top command display cpu, ram activity with load average time.

# top -u vpspro
top - 11:13:11 up  3:19,  2 users,  load average: 0.00, 0.00, 0.00
Tasks: 116 total,   1 running, 115 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1030800k total,   736188k used,   294612k free,    51760k buffers
Swap:  2064376k total,        0k used,  2064376k free,   547704k cached
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1889 tecmint   20   0 11468 1648  920 S  0.0  0.2   0:00.59 sshd
1890 tecmint   20   0  5124 1668 1416 S  0.0  0.2   0:00.44 bash
6698 tecmint   20   0 11600 1668  924 S  0.0  0.2   0:01.19 sshd
6699 tecmint   20   0  5124 1596 1352 S  0.0  0.2   0:00.11 bash

18. Tar Command

Tar command is used to compress files and folders in Linux.

To extract archive use: 
# tar -xvf archive-name.tar

To compress files:

# tar -cvf archive-name.tar /home
 
19. rm command

rm command used to remove or delete a file without prompting for confirmation.

# rm filename


20. mkdir command.

mkdir command is used to create directories under Linux.

# mkdir directoryname


Помог ли вам данный ответ?

 Распечатать статью

Также читают

Centos - turn off selinux

Add in console: sed -i "" -e "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config;...

Changing the root password

To change the root password, you must:Login as root using ssh and then type passwd command:...