Linux Commands That Every Linux System Administrator Should Know with Examples Part-2

This is the part-2 of our on going Linux commands series, earlier post where we have covered Linux Commands with Examples. In this article we going to see Linux Commands with examples. Let’s get started…

1.  alias command example
alias command helps you to define your own command or command shortcuts so that you can customize the command and it will work the way you want (Click on picture to enlarge it).
Syntax:
alias name=”value”
# alias tf=’tail -f /var/log/messages’
# tf

In the above,we have created tf alias to tail /var/log/messages. And tf command (Customize command) show the output of /var/log/messages.
Syntax:
unalias [aliasname]
We are unaliasing or removing tf command as shown in below output (Click on picture to enlarge it).
# unalias tf


2. id command example
id stands for identity, command to find out the user and group name and numeric ID of users on system. In short id command shows user’s information like UID, user belongs to which groups id (UID) etc.

Syntax:
id [OPTION] [USER]
$id
(Click on picture to enlarge it)
3. more command example

more command shows the content of a text file on terminal one screen at a time in case of large file and it is available on Unix and Unix-like operating system. Following keys are used in more command.
. Enter key: To scroll down page line by line
. Space bar: To go to next page
. b key: To go to the backward page
. / key: Search a string

Syntax:
more [options] file…
4. ssh command example

ssh stands for Secure Shell command is used login in the remote system, transfer files between two systems and executing commands on remote systems. As name suggest, it is secure connection between two hosts over an network and runs on TCP port 22.
Syntax:

ssh user@hostname/IP
$ ssh helen@192.168.56.102
(Click on picture to enlarge it)

5. kill command example

kill built-in command to terminate process manually. To kill a process we need to provide the PID of the process. ps is the command to display a list of running processes with their PID number. 
Syntax:
kill pid …
To list all available signals, use the -l
$ kill -l

(Click on picture to enlarge it)

6. last command example
last command searches through the file /var/log/wtmp and displays list of all users logged in and out
Syntax:
last [options] [username…] [tty…]
7. scp command example
scp (secure copy) command is to copy file(s) and directory(s) across the systems securely. During scp command it needs passwords or keys for authentication.
Syntax:
scp [options] [file_or_directory] [user]@[target_host:/directory]

(Click on picture to enlarge it)

8. rsync command example

rsync (Remote Sync) command to copy or synchronize files and directories locally or remote host. This is useful for data backup and mirror across Linux hosts.
Syntax:
rsync [OPTION…] SRC… [DEST]
9. ssh command example
ssh is a common way to connect remote Linux system. ssh (secure shell) command as well as protocol to securely connect to a remote hosts. ssh runs on TCP Port 22.
Syntax:
ssh user@remote_host

(Click on picture to enlarge it)

10. useradd command example
useradd or adduser command to create a new user. useradd commad will update system files and also create new user’s home directory and copy initial files. root access is required for useradd command.
Syntax:
useradd [options] [username]
(Click on picture to enlarge it)

11. passwd command example
passwd command to change user’s password. root access is required for passwd command.
Syntax:
passwd [username]
(Click on picture to enlarge it)

12. usermod command example
usermod  command to modify any attributes of existing user through command line such as changing user’s home directory, login name, password expiry date and more.
Syntax:
usermod [options] username

(Click on picture to enlarge it)


-d option to change user’s home directory during login.

13. userdel command example
userdel command to delete existing user account and it’s associated files and directories. The userdel command must be run as root credential.
Syntax:
userdel [options] username
# userdel -r ved
-r option will remove user’s home directory and mail spool.
14. ifconfig command example
ifconfig (Interface Configuration) command line utility is use for network configuration of Linux and Unix-like operating system also shows active interfaces and it’s IP address, netmask and other details.
Syntax:
ifconfig […OPTIONS] [INTERFACE]
$ ifconfig

(Click on picture to enlarge it)

-a : Shows all interfaces which are currently available even if is down.
15. IP command example
how to find IP Address of Linux System using command line? ip stands for Internet Protocol.  ip command is also one of the frequently use command in Linux. This command is use to perform several network administration tasks like assigning / deleting IP address, adding static and default route, set up tunnel over IP and more.   ip addr show command to find a list of all network interfaces details and it’s IP address associated with it.
Syntax:
ip [ OPTIONS ] OBJECT { COMMAND | help }
$ ip addr show 
(Click on picture to enlarge it)

16. man command
man (manual page) is an online manual of different commands which provide detailed descriptions and usage of the command and are available in Unix or Unix-Like Operating Systems.
Syntax:
man [commands]
$ man ls
17. exit command
exit command in Linux to exit from currently running shell or terminal.
Syntax:
exit
$ exit
18. sleep command example
sleep command is used to delay command or script execution for certain period of time. This will pause any command execution for particular purpose. We can set delay amount by Second, Minutes, Hours and Days.
Syntax:
sleep NUMBER[SUFFIX]
$ sleep 10
$ ls -l && sleep 1 && df -h
(Click on picture to enlarge it)

19. systemctl command examples
systemctl control the systemd system and service manager. systemctl command is the central management tool for controlling the init system. This will manage services, check status, change system states and work with configuration files. systemd is now the default init system for Linux distributions.
Syntax:
systemctl [OPTIONS…] COMMAND [NAME…]
To start service
# systemctl start cups.service.
To Stop Service
# systemctl stop cups.service.
To restart or reload service
# systemctl restart cups.service.
To enable Service
# systemctl enable cups.service.
To disable Service
# systemctl disable cups.service.
To check the Service status
# systemctl status cups.service.
(Click on picture to enlarge it)

20. uname command example
uname command used to determine the processor architecture, hostname and kernel version running on the system. It is easy and quick to get the system information using uname utility.
Syntax:
uname [OPTION]
# uname -a
(Click on picture to enlarge it)

21. ps command example
ps command to display a list of running processes with their PID number.
# ps -aux
(Click on picture to enlarge it)

In this post, we have covered 21 Linux command that Every Linux System Administrator Should Know With Examples. We will be covering another series of commands in the next articles. Stay tuned !!! Also share it with others also follow us on Facebook Official Page.

Leave a Comment