30 Best common commands used by Linux Unix Administrator

30 Best common commands used by Linux Unix Administrator

commands

 

1. ssh Command

SSH command is OpenSSH SSH client. It used by most of Linux Unix Administrator for remote control.

Example:

[root@localhost ~]# ssh kevin.ngo@192.168.0.112
kevin.ngo@192.168.0.112’s password:
[root@localhost ~]# ssh -l kevin.ngo 192.168.0.112
kevin.ngo@192.168.0.112’s password:

Debug mode for SSH client

[root@localhost ~]# ssh -v -l kevin.ngo 192.168.0.112
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.0.112 [192.168.0.112] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host ‘192.168.0.112’ is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
Cannot determine realm for numeric host addressdebug1: Unspecified GSS failure. Minor code may provide more information
Cannot determine realm for numeric host addressdebug1: Unspecified GSS failure. Minor code may provide more information
debug1: Unspecified GSS failure. Minor code may provide more information
Cannot determine realm for numeric host addressdebug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
kevin.ngo@192.168.0.112’s password:

2. ps command

ps command is used to display all proccess or daemon on Linux / Unix System.

Example:

Show all processes are running on Linux / Unix system.

[root@localhost ~]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 May29 ? 00:00:01 /sbin/init
root 2 0 0 May29 ? 00:00:00 [kthreadd]
root 3 2 0 May29 ? 00:00:00 [migration/0]
root 4 2 0 May29 ? 00:00:00 [ksoftirqd/0]
root 5 2 0 May29 ? 00:00:00 [migration/0]
root 6 2 0 May29 ? 00:00:00 [watchdog/0]
root 7 2 0 May29 ? 00:00:24 [events/0]
root 8 2 0 May29 ? 00:00:00 [cgroup]
root 9 2 0 May29 ? 00:00:00 [khelper]
root 10 2 0 May29 ? 00:00:00 [netns]
root 11 2 0 May29 ? 00:00:00 [async/mgr]
root 12 2 0 May29 ? 00:00:00 [pm]
root 13 2 0 May29 ? 00:00:01 [sync_supers]
root 14 2 0 May29 ? 00:00:00 [bdi-default]
root 15 2 0 May29 ? 00:00:00 [kintegrityd/0]
root 16 2 0 May29 ? 00:00:02 [kblockd/0]
root 17 2 0 May29 ? 00:00:00 [kacpid]
root 18 2 0 May29 ? 00:00:00 [kacpi_notify]
root 19 2 0 May29 ? 00:00:00 [kacpi_hotplug]
root 20 2 0 May29 ? 00:00:05 [ata/0]
root 21 2 0 May29 ? 00:00:00 [ata_aux]
root 22 2 0 May29 ? 00:00:00 [ksuspend_usbd]
root 23 2 0 May29 ? 00:00:00 [khubd]
root 24 2 0 May29 ? 00:00:00 [kseriod]
root 25 2 0 May29 ? 00:00:00 [md/0]
root 26 2 0 May29 ? 00:00:00 [md_misc/0]
root 27 2 0 May29 ? 00:00:00 [khungtaskd]
root 28 2 0 May29 ? 00:00:01 [kswapd0]
root 29 2 0 May29 ? 00:00:00 [ksmd]
root 30 2 0 May29 ? 00:00:02 [khugepaged]
root 31 2 0 May29 ? 00:00:00 [aio/0]
root 32 2 0 May29 ? 00:00:00 [crypto/0]
root 37 2 0 May29 ? 00:00:00 [kthrotld/0]
root 38 2 0 May29 ? 00:00:00 [pciehpd]
root 40 2 0 May29 ? 00:00:00 [kpsmoused]
root 41 2 0 May29 ? 00:00:00 [usbhid_resumer]
root 71 2 0 May29 ? 00:00:00 [kstriped]
root 241 2 0 May29 ? 00:00:00 [scsi_eh_0]
root 245 2 0 May29 ? 00:00:07 [scsi_eh_1]
root 254 2 0 May29 ? 00:00:01 [mpt_poll_0]
root 255 2 0 May29 ? 00:00:00 [mpt/0]
root 256 2 0 May29 ? 00:00:00 [scsi_eh_2]
root 377 2 0 May29 ? 00:00:03 [jbd2/sda2-8]
root 378 2 0 May29 ? 00:00:00 [ext4-dio-unwrit]
root 423 2 0 May29 ? 00:00:00 [kauditd]
root 466 2 0 May29 ? 00:00:01 [flush-8:0]
root 467 1 0 May29 ? 00:00:00 /sbin/udevd -d
root 649 2 0 May29 ? 00:00:02 [vmmemctl]
root 1111 2 0 May29 ? 00:00:00 [jbd2/sda1-8]
root 1112 2 0 May29 ? 00:00:00 [ext4-dio-unwrit]
root 1364 1 0 May29 ? 00:00:00 /usr/sbin/vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /var/run/vmblock-fuse
root 1386 1 0 May29 ? 00:02:38 /usr/sbin/vmtoolsd
root 1777 1 0 May29 ? 00:00:05 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
root 1847 2 0 May29 ? 00:00:00 [iprt/0]
dbus 1864 1 0 May29 ? 00:00:01 dbus-daemon –system
root 1874 1 0 May29 ? 00:00:00 NetworkManager –pid-file=/var/run/NetworkManager/NetworkManager.pid
root 1879 1 0 May29 ? 00:00:00 /usr/sbin/modem-manager
root 1894 1874 0 May29 ? 00:00:00 /sbin/dhclient -d -4 -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-eth0.pid -lf /var/lib/dhclient/dhclient-9dfdb5ba-5dc2-4ba7-a85d-ed1
root 1898 1 0 May29 ? 00:00:00 cupsd -C /etc/cups/cupsd.conf
root 1899 1 0 May29 ? 00:00:00 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -B -u -f /var/log/wpa_supplicant.log -P /var/run/wpa_supplicant.pid
root 1947 1 0 May29 ? 00:00:00 /usr/sbin/acpid
68 1956 1 0 May29 ? 00:00:00 hald
root 1957 1956 0 May29 ? 00:00:00 hald-runner
root 1997 1957 0 May29 ? 00:00:00 hald-addon-input: Listening on /dev/input/event2 /dev/input/event0
68 2005 1957 0 May29 ? 00:00:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
root 2039 1 0 May29 ? 00:00:00 /usr/sbin/sshd
root 2081 1 0 May29 ? 00:00:00 tpvmlpd2
root 2121 1 0 May29 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –socket=/var/lib/mysql/mysql.sock –pid-file=/var/run/mysqld/mysqld.pid –basedir=/usr –user=
mysql 2253 2121 0 May29 ? 00:00:12 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –log-error=/var/log/mysqld.log –pid-file=/var/run/mysqld/mysqld.pid –sock
root 2363 1 0 May29 ? 00:00:00 /usr/libexec/postfix/master
postfix 2389 2363 0 May29 ? 00:00:00 qmgr -l -t fifo -u
root 2399 1 0 May29 ? 00:00:00 /usr/sbin/abrtd
root 2466 1 0 May29 ? 00:00:02 /usr/sbin/httpd
root 2477 1 0 May29 ? 00:00:00 crond
502 2509 1 0 May29 ? 00:00:04 /usr/bin/Xvnc :2 -desktop localhost.localdomain:2 (kevin.ngo) -auth /home/kevin.ngo/.Xauthority -geometry 1024×768 -rfbwait 30000 -rfbauth /home/kevi
502 2526 1 0 May29 ? 00:00:00 /usr/bin/ck-xinit-session /usr/bin/ssh-agent /etc/X11/xinit/Xclients
502 2532 2526 0 May29 ? 00:00:00 vncconfig -iconic
root 2540 1 0 May29 ? 00:00:00 /usr/sbin/atd
502 2553 1 0 May29 ? 00:00:00 dbus-launch –sh-syntax –exit-with-session
root 2560 1 0 May29 ? 00:00:00 /usr/sbin/gdm-binary -nodaemon
root 2567 1 0 May29 tty2 00:00:00 /sbin/mingetty /dev/tty2
root 2569 1 0 May29 tty3 00:00:00 /sbin/mingetty /dev/tty3
root 2571 1 0 May29 tty4 00:00:00 /sbin/mingetty /dev/tty4
root 2573 1 0 May29 tty5 00:00:00 /sbin/mingetty /dev/tty5
root 2575 1 0 May29 tty6 00:00:00 /sbin/mingetty /dev/tty6
root 2578 467 0 May29 ? 00:00:00 /sbin/udevd -d
root 2579 467 0 May29 ? 00:00:00 /sbin/udevd -d
root 2590 2560 0 May29 ? 00:00:00 /usr/libexec/gdm-simple-slave –display-id /org/gnome/DisplayManager/Display1 –force-active-vt
root 2592 2590 0 May29 tty1 00:00:33 /usr/bin/Xorg :0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-yOF67D/database -nolisten tcp vt1
502 2593 1 0 May29 ? 00:00:00 /bin/dbus-daemon –fork –print-pid 5 –print-address 7 –session
root 2599 1 0 May29 ? 00:00:00 /usr/sbin/console-kit-daemon –no-daemon
502 2669 2526 0 May29 ? 00:00:00 /usr/bin/gnome-session
502 2670 2669 0 May29 ? 00:00:00 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
root 2679 1 0 May29 ? 00:00:00 /usr/libexec/devkit-power-daemon
gdm 2694 1 0 May29 ? 00:00:00 /usr/bin/dbus-launch –exit-with-session
502 2700 1 0 May29 ? 00:00:00 /usr/libexec/gconfd-2
502 2734 1 0 May29 ? 00:00:01 /usr/libexec/gnome-settings-daemon
502 2737 1 0 May29 ? 00:00:00 gnome-keyring-daemon –start
502 2740 1 0 May29 ? 00:00:00 seahorse-daemon
502 2747 1 0 May29 ? 00:00:00 /usr/libexec/gvfsd
502 2756 2669 0 May29 ? 00:00:00 metacity
502 2770 1 0 May29 ? 00:00:00 /usr/bin/pulseaudio –start –log-target=syslog
rtkit 2772 1 0 May29 ? 00:00:00 /usr/libexec/rtkit-daemon
root 2780 1 0 May29 ? 00:00:00 /usr/libexec/polkit-1/polkitd
502 2782 2669 0 May29 ? 00:00:01 gnome-panel
502 2799 2669 0 May29 ? 00:00:01 nautilus
502 2801 1 0 May29 ? 00:00:00 /usr/libexec/bonobo-activation-server –ac-activate –ior-output-fd=18
502 2810 1 0 May29 ? 00:00:00 /usr/libexec/wnck-applet –oaf-activate-iid=OAFIID:GNOME_Wncklet_Factory –oaf-ior-fd=18
502 2811 1 0 May29 ? 00:00:00 /usr/libexec/gvfs-gdu-volume-monitor
502 2812 1 0 May29 ? 00:00:00 /usr/libexec/trashapplet –oaf-activate-iid=OAFIID:GNOME_Panel_TrashApplet_Factory –oaf-ior-fd=24
root 2814 1 0 May29 ? 00:00:00 /usr/libexec/udisks-daemon
502 2816 1 0 May29 ? 00:00:00 /usr/libexec/gvfsd-trash –spawner :1.8 /org/gtk/gvfs/exec_spaw/0
root 2817 2814 0 May29 ? 00:00:16 udisks-daemon: polling /dev/sr0
502 2819 1 0 May29 ? 00:00:02 /usr/libexec/gvfs-afc-volume-monitor
502 2831 1 0 May29 ? 00:03:50 /usr/lib/vmware-tools/sbin64/vmtoolsd -n vmusr –blockFd 3
502 2833 1 0 May29 ? 00:00:00 /usr/libexec/gvfs-gphoto2-volume-monitor
502 2835 2669 0 May29 ? 00:00:00 python /usr/share/system-config-printer/applet.py
502 2842 2669 0 May29 ? 00:00:00 /usr/libexec/gdu-notification-daemon
502 2845 2669 0 May29 ? 00:00:00 gpk-update-icon
502 2847 2669 0 May29 ? 00:00:00 gnome-power-manager
502 2850 2669 0 May29 ? 00:00:00 bluetooth-applet
502 2852 2669 0 May29 ? 00:00:00 gnome-volume-control-applet
502 2854 2669 0 May29 ? 00:00:00 /usr/libexec/polkit-gnome-authentication-agent-1
502 2860 2770 0 May29 ? 00:00:00 /usr/libexec/pulse/gconf-helper
502 2866 1 0 May29 ? 00:00:01 gnome-screensaver
502 2883 1 0 May29 ? 00:00:00 /usr/bin/gnote –panel-applet –oaf-activate-iid=OAFIID:GnoteApplet_Factory –oaf-ior-fd=19
502 2884 1 0 May29 ? 00:00:00 /usr/libexec/gdm-user-switch-applet –oaf-activate-iid=OAFIID:GNOME_FastUserSwitchApplet_Factory –oaf-ior-fd=28
502 2885 1 0 May29 ? 00:00:00 /usr/libexec/clock-applet –oaf-activate-iid=OAFIID:GNOME_ClockApplet_Factory –oaf-ior-fd=34
502 2886 1 0 May29 ? 00:00:00 /usr/libexec/notification-area-applet –oaf-activate-iid=OAFIID:GNOME_NotificationAreaApplet_Factory –oaf-ior-fd=40
root 2897 2590 0 May29 ? 00:00:00 pam: gdm-password
root 2933 1 0 May29 ? 00:00:00 auditd
502 3010 1 0 May29 ? 00:00:00 /usr/libexec/gvfsd-burn –spawner :1.8 /org/gtk/gvfs/exec_spaw/1
root 3133 1 0 May29 ? 00:00:00 /usr/bin/gnome-keyring-daemon –daemonize –login
root 3142 2897 0 May29 ? 00:00:00 gnome-session
root 3150 1 0 May29 ? 00:00:00 dbus-launch –sh-syntax –exit-with-session
root 3151 1 0 May29 ? 00:00:00 /bin/dbus-daemon –fork –print-pid 5 –print-address 7 –session
root 3164 1 0 May29 ? 00:00:00 /usr/libexec/gconfd-2
root 3173 1 0 May29 ? 00:00:01 /usr/libexec/gnome-settings-daemon
root 3174 1 0 May29 ? 00:00:00 seahorse-daemon
root 3179 1 0 May29 ? 00:00:00 /usr/libexec/gvfsd
root 3185 1 0 May29 ? 00:00:00 /usr/libexec//gvfs-fuse-daemon /root/.gvfs
root 3192 3142 0 May29 ? 00:00:00 metacity
root 3204 3142 0 May29 ? 00:00:01 gnome-panel
root 3205 3142 0 May29 ? 00:00:01 nautilus
root 3207 1 0 May29 ? 00:00:00 /usr/libexec/bonobo-activation-server –ac-activate –ior-output-fd=18
root 3215 1 0 May29 ? 00:00:00 /usr/libexec/gvfs-gdu-volume-monitor
root 3216 1 0 May29 ? 00:00:00 /usr/libexec/wnck-applet –oaf-activate-iid=OAFIID:GNOME_Wncklet_Factory –oaf-ior-fd=18
root 3218 1 0 May29 ? 00:00:00 /usr/libexec/trashapplet –oaf-activate-iid=OAFIID:GNOME_Panel_TrashApplet_Factory –oaf-ior-fd=26
root 3220 1 0 May29 ? 00:00:02 /usr/libexec/gvfs-afc-volume-monitor
root 3223 1 0 May29 ? 00:00:00 /usr/libexec/gvfs-gphoto2-volume-monitor
root 3225 1 0 May29 ? 00:00:00 /usr/libexec/gvfsd-trash –spawner :1.7 /org/gtk/gvfs/exec_spaw/0
root 3230 1 0 May29 ? 00:00:00 /usr/libexec/gdm-user-switch-applet –oaf-activate-iid=OAFIID:GNOME_FastUserSwitchApplet_Factory –oaf-ior-fd=34
root 3231 1 0 May29 ? 00:00:00 /usr/libexec/clock-applet –oaf-activate-iid=OAFIID:GNOME_ClockApplet_Factory –oaf-ior-fd=40
root 3232 1 0 May29 ? 00:00:00 /usr/libexec/notification-area-applet –oaf-activate-iid=OAFIID:GNOME_NotificationAreaApplet_Factory –oaf-ior-fd=28
root 3233 1 0 May29 ? 00:00:00 /usr/bin/gnote –panel-applet –oaf-activate-iid=OAFIID:GnoteApplet_Factory –oaf-ior-fd=20
root 3248 1 0 May29 ? 00:02:24 /usr/lib/vmware-tools/sbin64/vmtoolsd -n vmusr –blockFd 3
root 3249 3142 0 May29 ? 00:00:00 python /usr/share/system-config-printer/applet.py
root 3252 3142 0 May29 ? 00:00:00 /usr/libexec/gdu-notification-daemon
root 3256 3142 0 May29 ? 00:00:00 gpk-update-icon
root 3258 3142 0 May29 ? 00:00:00 gnome-power-manager
root 3262 3142 0 May29 ? 00:00:00 bluetooth-applet
root 3263 3142 0 May29 ? 00:00:00 gnome-volume-control-applet
root 3266 3142 0 May29 ? 00:00:00 nm-applet –sm-disable
root 3268 3142 0 May29 ? 00:00:00 /usr/libexec/polkit-gnome-authentication-agent-1
root 3273 1 0 May29 ? 00:00:00 /usr/bin/pulseaudio –start
root 3283 3273 0 May29 ? 00:00:00 /usr/libexec/pulse/gconf-helper
root 3293 1 0 May29 ? 00:00:02 gnome-screensaver
root 3317 1 0 May29 ? 00:00:00 /usr/libexec/gvfsd-burn –spawner :1.7 /org/gtk/gvfs/exec_spaw/1
root 3319 1 0 May29 ? 00:00:00 /usr/libexec/gvfsd-metadata
apache 10314 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
apache 10315 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
apache 10316 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
apache 10317 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
apache 10318 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
apache 10319 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
apache 10320 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
apache 10321 2466 0 May29 ? 00:00:00 /usr/sbin/httpd
root 17075 2854 0 May29 ? 00:00:00 /usr/libexec/polkit-1/polkit-agent-helper-1 root cookie18
root 17103 1 0 May29 ? 00:00:00 /usr/bin/gnome-terminal -x /bin/sh -c cd ‘/root/Desktop’ && exec $SHELL
root 17104 17103 0 May29 ? 00:00:00 gnome-pty-helper
root 17105 17103 0 May29 pts/0 00:00:00 /bin/bash
root 17149 17105 0 May29 pts/0 00:00:05 /opt/google/chrome/chrome –user-data-dir /home/kevin.ngo
root 17154 17149 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –user-data-dir /home/kevin.ngo
root 17156 17149 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome-sandbox /opt/google/chrome/chrome –type=zygote –user-data-dir
root 17157 17156 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=zygote –user-data-dir
root 17160 17157 0 May29 pts/0 00:00:00 /opt/google/chrome/nacl_helper_bootstrap /opt/google/chrome/nacl_helper –reserved_at_zero=0x0000000000000000 –r_debug=0x0000000000213000
root 17162 17157 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=zygote –user-data-dir
root 17266 17162 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=renderer –lang=en-US –force-fieldtrials=ForceCompositingMode/disable/InfiniteCache/No/OmniboxHQPReplaceHUPProhibit
root 17276 17162 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=renderer –lang=en-US –force-fieldtrials=ForceCompositingMode/disable/InfiniteCache/No/OmniboxHQPReplaceHUPProhibit
postfix 20336 2363 0 00:16 ? 00:00:00 pickup -l -t fifo -u
root 20370 17103 0 00:18 pts/1 00:00:00 /bin/bash
root 20396 2039 0 00:18 ? 00:00:00 sshd: root@pts/2
root 20404 20396 0 00:18 pts/2 00:00:00 -bash
root 20597 1 0 00:28 ? 00:00:00 /usr/sbin/packagekitd
root 20648 20404 1 00:31 pts/2 00:00:00 ps -ef
[root@localhost ~]#

3.  top command

Top command is using to display top processes which consume high CPU, Memory.

Also show total CPU and Memory on Linux System.

Example:

top
top – 00:57:59 up 9:59, 4 users, load average: 0.00, 0.03, 0.01
Tasks: 194 total, 1 running, 193 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.7%us, 0.3%sy, 0.0%ni, 98.3%id, 0.7%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1012548k total, 933812k used, 78736k free, 59228k buffers
Swap: 2031608k total, 39188k used, 1992420k free, 407104k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2817 root 20 0 40336 616 544 S 2.0 0.1 0:17.87 udisks-daemon
21036 root 20 0 15160 1196 840 R 2.0 0.1 0:00.01 top
1 root 20 0 19356 1332 1040 S 0.0 0.1 0:01.18 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.77 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.60 watchdog/0
7 root 20 0 0 0 0 S 0.0 0.0 0:25.78 events/0
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cgroup
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 netns
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 async/mgr
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pm
13 root 20 0 0 0 0 S 0.0 0.0 0:01.59 sync_supers
14 root 20 0 0 0 0 S 0.0 0.0 0:00.42 bdi-default
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kintegrityd/0
16 root 20 0 0 0 0 S 0.0 0.0 0:02.58 kblockd/0
17 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kacpid
18 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kacpi_notify
19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kacpi_hotplug
20 root 20 0 0 0 0 S 0.0 0.0 0:06.02 ata/0
21 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ata_aux
22 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksuspend_usbd
23 root 20 0 0 0 0 S 0.0 0.0 0:00.08 khubd
24 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kseriod
25 root 20 0 0 0 0 S 0.0 0.0 0:00.00 md/0
26 root 20 0 0 0 0 S 0.0 0.0 0:00.00 md_misc/0
27 root 20 0 0 0 0 S 0.0 0.0 0:00.02 khungtaskd
28 root 20 0 0 0 0 S 0.0 0.0 0:01.39 kswapd0
29 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
30 root 39 19 0 0 0 S 0.0 0.0 0:02.81 khugepaged
31 root 20 0 0 0 0 S 0.0 0.0 0:00.00 aio/0
32 root 20 0 0 0 0 S 0.0 0.0 0:00.00 crypto/0
37 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthrotld/0
38 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pciehpd

Show top processes with user

top -u kevin.ngo
top – 00:58:41 up 10:00, 4 users, load average: 0.10, 0.06, 0.01
Tasks: 194 total, 1 running, 193 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.7%us, 0.4%sy, 0.0%ni, 98.2%id, 0.7%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1012548k total, 933812k used, 78736k free, 59300k buffers
Swap: 2031608k total, 39188k used, 1992420k free, 407112k cachedPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2831 kevin.ng 20 0 472m 6772 3644 S 6.3 0.7 4:06.86 vmtoolsd
2509 kevin.ng 20 0 103m 25m 5792 S 0.0 2.5 0:04.33 Xvnc
2526 kevin.ng 20 0 12668 628 624 S 0.0 0.1 0:00.01 ck-xinit-sessio
2532 kevin.ng 20 0 47776 1596 1504 S 0.0 0.2 0:00.02 vncconfig
2553 kevin.ng 20 0 20036 392 388 S 0.0 0.0 0:00.00 dbus-launch
2593 kevin.ng 20 0 21924 1176 584 S 0.0 0.1 0:00.09 dbus-daemon
2669 kevin.ng 20 0 246m 6104 5428 S 0.0 0.6 0:00.13 gnome-session
2670 kevin.ng 20 0 55228 128 92 S 0.0 0.0 0:00.37 ssh-agent
2700 kevin.ng 20 0 130m 2924 2148 S 0.0 0.3 0:00.38 gconfd-2
2734 kevin.ng 20 0 493m 8096 6776 S 0.0 0.8 0:01.24 gnome-settings-
2737 kevin.ng 20 0 159m 864 860 S 0.0 0.1 0:00.00 gnome-keyring-d
2740 kevin.ng 20 0 285m 5996 5612 S 0.0 0.6 0:00.14 seahorse-daemon
2747 kevin.ng 20 0 131m 1808 1644 S 0.0 0.2 0:00.01 gvfsd
2756 kevin.ng 20 0 277m 9.8m 7560 S 0.0 1.0 0:00.44 metacity
2770 kevin.ng 20 0 360m 2452 1908 S 0.0 0.2 0:00.04 pulseaudio
2782 kevin.ng 20 0 324m 12m 9340 S 0.0 1.2 0:01.16 gnome-panel
2799 kevin.ng 20 0 465m 17m 10m S 0.0 1.7 0:01.36 nautilus
2801 kevin.ng 20 0 615m 4812 2524 S 0.0 0.5 0:00.06 bonobo-activati
2810 kevin.ng 20 0 318m 11m 8456 S 0.0 1.1 0:00.36 wnck-applet
2811 kevin.ng 20 0 140m 2492 2196 S 0.0 0.2 0:00.05 gvfs-gdu-volume
2812 kevin.ng 20 0 317m 8688 7420 S 0.0 0.9 0:00.13 trashapplet
2816 kevin.ng 20 0 137m 2448 2168 S 0.0 0.2 0:00.00 gvfsd-trash
2819 kevin.ng 20 0 226m 1496 1472 S 0.0 0.1 0:02.87 gvfs-afc-volume

4.  df command

df command is using to display disk usage on Linux Unix System.

Example:

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.7G 3.9G 5.3G 42% /
tmpfs 495M 444K 494M 1% /dev/shm
/dev/sda1 291M 56M 221M 20% /boot
[root@localhost ~]#

5.  kill command

kill command is using to terminate a process on Linux/Unix System.

Example:

Kill google chrome process on Linux/Unix System.

[root@localhost ~]# ps -ef | grep chrome
root 17149 17105 0 May29 pts/0 00:00:07 /opt/google/chrome/chrome –user-data-dir /home/kevin.ngo
root 17154 17149 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –user-data-dir /home/kevin.ngo
root 17156 17149 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome-sandbox /opt/google/chrome/chrome –type=zygote –user-data-dir
root 17157 17156 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=zygote –user-data-dir
root 17160 17157 0 May29 pts/0 00:00:00 /opt/google/chrome/nacl_helper_bootstrap /opt/google/chrome/nacl_helper –reserved_at_zero=0x0000000000000000 –r_debug=0x0000000000213000
root 17162 17157 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=zygote –user-data-dir
root 17266 17162 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=renderer –lang=en-US –force-fieldtrials=ForceCompositingMode/disable/InfiniteCache/No/OmniboxHQPReplaceHUPProhibitTrumpingInlineableResult/Standard/OmniboxSearchSuggestTrialStarted2013Q1/4/OneClickSignIn/Standard/Prerender/PrerenderEnabled/UMA-New-Install-Uniformity-Trial/Control/UMA-Session-Randomized-Uniformity-Trial-5-Percent/group_16/UMA-Uniformity-Trial-1-Percent/group_65/UMA-Uniformity-Trial-10-Percent/group_02/UMA-Uniformity-Trial-20-Percent/group_04/UMA-Uniformity-Trial-5-Percent/group_03/UMA-Uniformity-Trial-50-Percent/group_01/ –renderer-print-preview –signin-process –disable-accelerated-2d-canvas –disable-accelerated-video-decode –channel=17149.0.2041656182
root 17276 17162 0 May29 pts/0 00:00:00 /opt/google/chrome/chrome –type=renderer –lang=en-US –force-fieldtrials=ForceCompositingMode/disable/InfiniteCache/No/OmniboxHQPReplaceHUPProhibitTrumpingInlineableResult/Standard/OmniboxSearchSuggestTrialStarted2013Q1/4/OneClickSignIn/Standard/Prerender/PrerenderEnabled/UMA-New-Install-Uniformity-Trial/Control/UMA-Session-Randomized-Uniformity-Trial-5-Percent/group_16/UMA-Uniformity-Trial-1-Percent/group_65/UMA-Uniformity-Trial-10-Percent/group_02/UMA-Uniformity-Trial-20-Percent/group_04/UMA-Uniformity-Trial-5-Percent/group_03/UMA-Uniformity-Trial-50-Percent/group_01/ –renderer-print-preview –disable-accelerated-2d-canvas –disable-accelerated-video-decode –channel=17149.1.777316146
root 21110 20404 0 01:01 pts/2 00:00:00 grep chrome
[root@localhost ~]# kill -9 17149
[root@localhost ~]# ps -ef | grep chrome
root 21115 20404 0 01:02 pts/2 00:00:00 grep chrome
[root@localhost ~]#

6. mount command

Mount command is using to mount a file system to Linux/Unix. Normally it can be used for mount CD to Linux/Unix System.

Example:

[root@localhost ~]# mount /dev/sr0 /mnt
[root@localhost ~]# mount /dev/sdb1 /mnt

7. chmod command

chmod command is using to change the permission for file or folder on Linux Unix System.

Example:

chmod 777 /tmp/testfile
chmod ug+rwx /tmp/testfile

8. chown command

chown command is using to change owner for file or folder on Linux/Unix System.

Example:

chown kevin.linuxadmins /tmp/testfile
chown -R kevin.linuxadmins /home/kevin

9. uname command

uname command is using to show kernel name, Host name, Kernel release number … on Linux/Unix System.

Example:

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#

10. tail command

tail command is using to print last lines of the file on Linux/Unix System.

Example:

[root@localhost ~]# tail /var/log/messages
May 30 01:11:58 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:11:59 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:00 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:01 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:02 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:03 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:04 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:05 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:06 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
May 30 01:12:07 localhost vmusr[3248]: [ warning] [vmusr] Error in the RPC receive loop: RpcIn: Unable to send.
[root@localhost ~]#

11. yum command

yum command is using for install, update, upgrade package or Linux/Unix system.

Example:

[root@localhost ~]# yum install ntp
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Could not get metalink https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64 error was
14: PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrors.fedoraproject.org'”
* base: mirrors.vonline.vn
* epel: kartolo.sby.datautama.net.id
* extras: mirrors.vonline.vn
* updates: mirrors.vonline.vn
adobe-linux-x86_64 | 951 B 00:00
base | 3.7 kB 00:00
chrome | 951 B 00:00
extras | 3.5 kB 00:00
google-chrome | 951 B 00:00
updates | 3.4 kB 00:00
virtualbox | 951 B 00:00
Setting up Install Process
Package ntp-4.2.4p8-3.el6.centos.x86_64 already installed and latest version
Nothing to do
[root@localhost ~]#

12. rpm command

rpm command is using for install the package on Linux/Unix System.

Example:

To install a package

rpm -ivh skype-4.2.0.11.el6.rpm

To uninstall a package

rpm -e skype-4.2.0.11.el6

13. wget command

wget command is using to download a package on internet.

Example:

wget http://download.skype.com/linux/skype-4.2.0.11.tar.bz2

14. crontab command

crontab command is using to scheduling a task or a service or a command to run at specific time.

Example:

Every 10 min , run one bash script

*/10 * * * * /usr/sbin/checkservice.sh

15. find command

find command is using to find a file name on Linux/Unix System

Example:

[root@localhost tmp]# find / -name loganalyzer-3.6.3.tar.gz
/root/loganalyzer-3.6.3.tar.gz

Find empty files on system

[root@localhost tmp]# find / -empty

16. tar command

tar command is using to create tar archive or extract tar archive

Example:

Create backup.tar file for /var

tar cvf backup.tar /var

Extract a tar file

tar -xzvf backup.tar

17. vim command

vim command is using to modify or create or open a file.

Example:

vim testfile

Go to line 5 on one textfile

vim +5 testfile

Go to the first match line “kevin” in one file

[root@localhost tmp]# vim +/kevin /etc/passwd

18. ls command

ls command is using to display file or filesize on Linux/Unix System.

Example:

[root@localhost tmp]# ls -lah
total 79M
drwxrwxrwt. 29 root root 4.0K May 30 00:20 .
dr-xr-xr-x. 22 root root 4.0K May 29 18:13 ..
drwx—— 2 root root 4.0K May 29 17:43 .com.google.Chrome.5Tm5La
drwx—— 2 root root 4.0K May 29 17:49 CRX_75DAF8CB7768
drwx——. 2 root root 4.0K May 24 07:08 .esd-0
drwx——. 2 kevin.ngo kevin.ngo 4.0K May 24 06:56 .esd-502
drwxrwxrwt 2 root root 4.0K May 24 07:08 .ICE-unix
drwx—— 2 kevin.ngo kevin.ngo 4.0K May 24 06:56 keyring-KyFb8y
drwx——. 2 root root 4.0K Apr 6 01:43 keyring-Ne5COq
drwx—— 2 kevin.ngo kevin.ngo 4.0K Apr 21 22:53 keyring-ql7j2r
drwx—— 2 root root 4.0K Apr 27 10:52 keyring-ukw4W8
drwx—— 2 root root 4.0K May 24 07:08 keyring-uX7ekW
drwx—— 2 gdm gdm 4.0K May 24 07:08 orbit-gdm
drwx—— 2 kevin.ngo kevin.ngo 4.0K May 24 06:56 orbit-kevin.ngo
drwx—— 2 root root 4.0K May 29 17:43 orbit-root
drwx——. 2 kevin.ngo kevin.ngo 4.0K May 24 06:56 pulse-JrdAyWTz7MEy
drwx——. 2 root root 4.0K May 24 07:08 pulse-OLoXxJiWNcOS
drwx—— 2 gdm gdm 4.0K May 24 07:08 pulse-YAq70ZFQxgoX
srwxr-xr-x 1 root root 0 May 24 08:09 qtsingleapp-rootSk-5076-0
-rw-r–r– 1 root root 0 May 24 06:53 qtsingleapp-rootSk-5076-0-lockfile
srwxr-xr-x 1 root root 0 May 24 04:19 qtsingleapp-skype-978-0
-rw-r–r– 1 root root 0 May 24 04:19 qtsingleapp-skype-978-0-lockfile
-rw-r–r– 1 root root 16M May 6 16:44 skype-4.2.0.11.tar.bz2
drwx—— 2 kevin.ngo kevin.ngo 4.0K May 24 06:56 ssh-oPpaWn2669
drwx—— 2 root root 4.0K Apr 27 11:50 .vbox-root-ipc
drwx—— 2 kevin.ngo kevin.ngo 4.0K May 24 06:56 virtual-kevin.ngo.7zB8MF
drwx—— 2 kevin.ngo kevin.ngo 4.0K May 24 03:37 virtual-kevin.ngo.PsYqVC
drwx—— 2 root root 4.0K May 24 07:08 virtual-root.UYnyMW
drwxrwxrwt. 2 root root 4.0K Apr 8 03:30 VMwareDnD
drwx—— 2 kevin.ngo kevin.ngo 4.0K May 24 06:56 vmware-kevin.ngo
drwxr-xr-x 2 root root 4.0K May 24 06:56 vmware-root
drwx—— 2 root root 4.0K May 24 07:08 vmware-root-1709517905
-r–r–r–. 1 root root 64M Mar 25 22:25 VMwareTools-9.2.0-799703.tar.gz
drwxr-xr-x. 4 root root 4.0K Aug 1 2012 vmware-tools-distrib
-r–r–r– 1 root root 11 May 24 06:56 .X0-lock
drwxrwxrwt 2 root root 4.0K May 24 06:56 .X11-unix
-r–r–r– 1 kevin.ngo kevin.ngo 11 May 24 06:56 .X2-lock
-rw——- 1 root root 27K May 24 03:43 yum_save_tx-2013-05-24-03-43CfHDmF.yumtx
[root@localhost tmp]#

19. gzip command

gzip command is using to create or extract gzip file.

Example:

Create gzip file

[root@localhost tmp]# gzip backupfile

Extract gzip file

[root@localhost tmp]# gzip -d backupfile.gz

20. ftp command

ftp command is using to connect remote server to download multiple files.

Example:

ftp 192.168.0.112ftp> mget *.tar

21. service command

service command is using to control the service on Linux/Unix system.

We can start, stop, restart or reload the service.

Example:

[root@localhost tmp]# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[root@localhost tmp]#

22. ping command

ping command is using to check the host live or not in your network.

Example:

[root@localhost tmp]# ping 192.168.0.110
PING 192.168.0.110 (192.168.0.110) 56(84) bytes of data.
64 bytes from 192.168.0.110: icmp_seq=1 ttl=128 time=0.339 ms
64 bytes from 192.168.0.110: icmp_seq=2 ttl=128 time=0.255 ms
64 bytes from 192.168.0.110: icmp_seq=3 ttl=128 time=0.265 ms
64 bytes from 192.168.0.110: icmp_seq=4 ttl=128 time=0.271 ms
^C
— 192.168.0.110 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3422ms
rtt min/avg/max/mdev = 0.255/0.282/0.339/0.037 ms
[root@localhost tmp]#

23. date command

date command is using to view or modify the time on Linux/Unix system.

Example:

View the date/time

[root@localhost tmp]# date
Thu May 30 02:07:23 PDT 2013
[root@localhost tmp]#

Change the date/time

[root@localhost tmp]# date -s “05/30/2013 16:59:53”
Thu May 30 16:59:53 PDT 2013
[root@localhost tmp]#

24. su command

su command is using to switch to another user on Linux/Unix System.

Example:

su kevin.ngo

25. man command

man command is using to show the manual for the command on Unix/Linux system

Example:

man ls

26. useradd command

useradd command is using to create a new user on Linux/Unix System.

Example:

[root@localhost tmp]# useradd kevin2
[root@localhost tmp]# passwd kevin2
Changing password for user kevin2.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost tmp]#

27. cp command

cp command is using to copy a file or folder to others.

Example:

cp testfile01 testfile01.backup

28. rm command

rm command is using to remove a file or folder on Linux/Unix system.

Example:

rm testfile01
rm -rf /tmp/testfolder

29. mv command

mv command is using to move a file to others.

Example:

mv file1 file2
mv file2 file3

30. grep command

grep command is using to search a string on Linux/Unix System.

Example:

[root@localhost ~]# grep -r “kevin” /etc/*
/etc/group:kevin:x:501:
/etc/group:kevin.ngo:x:502:
/etc/group:vboxusers:x:503:kevin.ngo,root
/etc/group:kevin2:x:504:
/etc/group-:kevin:x:501:
/etc/group-:kevin.ngo:x:502:
/etc/group-:vboxusers:x:503:kevin.ngo,root
/etc/gshadow:kevin:!::
/etc/gshadow:kevin.ngo:!::
/etc/gshadow:vboxusers:!::kevin.ngo,root
/etc/gshadow:kevin2:!::
/etc/gshadow-:kevin:!::
/etc/gshadow-:kevin.ngo:!::
/etc/gshadow-:vboxusers:!::kevin.ngo,root
/etc/passwd:kevin:x:501:501::/home/kevin:/bin/bash
/etc/passwd:kevin.ngo:x:502:502::/home/kevin.ngo:/bin/bash
/etc/passwd:kevin2:x:503:504::/home/kevin2:/bin/bash
/etc/passwd-:kevin:x:501:501::/home/kevin:/bin/bash
/etc/passwd-:kevin.ngo:x:502:502::/home/kevin.ngo:/bin/bash
/etc/shadow:kevin:!!:15816:0:99999:7:::
/etc/shadow:kevin.ngo:!!:15816:0:99999:7:::
/etc/shadow:kevin2:$1$THqEmcH1$8tyKOi/dWZkveTizZrNOD/:15856:0:99999:7:::
/etc/shadow-:kevin:!!:15816:0:99999:7:::
/etc/shadow-:kevin.ngo:!!:15816:0:99999:7:::
/etc/sysconfig/vncservers:VNCSERVERS=”2:kevin.ngo”
[root@localhost ~]#

We hope you are happy with these commands.

Thanks for using IThelpblog.com.

One comment to 30 Best common commands used by Linux Unix Administrator

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>