Basic Linux commands used by SysAdmin and Developers
man – Manual Command
man – Manual command in Linux is used to display or check the user manual of any command that we can run on the terminal.
[simterm]
[root@zoomtutorials ~]# man
What manual page do you want?
[root@zoomtutorials ~]# man ls
LS(1) User Commands LS(1)
NAME
ls – list directory contents
SYNOPSIS
ls [OPTION]… [FILE]…
DESCRIPTION
List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor –sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, –all
do not ignore entries starting with .
-A, –almost-all
do not list implied . and ..
–author
with -l, print the author of each file
-b, –escape
print C-style escapes for nongraphic characters
–block-size=SIZE
scale sizes by SIZE before printing them; e.g., ‘–block-size=M’ prints sizes in units of 1,048,576 bytes; see SIZE format below
-B, –ignore-backups
do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest
first
-C list entries by columns
–color[=WHEN]
colorize the output; WHEN can be ‘never’, ‘auto’, or ‘always’ (the default); more info below
-d, –directory
list directories themselves, not their contents
-D, –dired
Manual page ls(1) line 1 (press h for help or q to quit)
[root@zoomtutorials ~]#
[/simterm]
ls – List Command
ls – List command in linux is used to list contents of a directory. The -l option enables long listing format as shown below:
You can also type ls -l in short as ll and both shows same output as shown below:
[simterm]
[root@zoomtutorials ~]# ls
bak
[root@zoomtutorials ~]# ls -l
total 4
drwxr-xr-x 6 root root 4096 Jul 20 14:53 bak
[root@zoomtutorials ~]# ll
total 4
drwxr-xr-x 6 root root 4096 Jul 20 14:53 bak
[root@zoomtutorials ~]#
[/simterm]
cat – Cat(concatenate) command
cat – (short for “concatenate“) command in linux is one of the most frequently used command in Linux/Unix like operating systems. It reads data from the file and gives their content as output. cat command allows us to create single or multiple files, view contain of file, concatenate files and redirect output in terminal or files.
[simterm]
[root@zoomtutorials home]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@zoomtutorials home]#
[/simterm]
cd – Change Directory
cd – cd command in linux known as change directory command. It is used to change current working directory. In the below example, we have checked the current working directory of the user and moved inside the homedirectory by using ‘cd home‘ command.
[simterm]
[root@zoomtutorials ~]# pwd
/root
[root@zoomtutorials ~]# cd /home/
[root@zoomtutorials home]# pwd
/home
[root@zoomtutorials home]#
[/simterm]
pwd – Print Working Directory
pwd – ‘pwd‘ stands for ‘Print Working Directory’. As the name states, command ‘pwd‘ prints the current working directory or simply the directory user.
[simterm]
[root@zoomtutorials home]# cd /var/www
[root@zoomtutorials www]# pwd
/var/www
[root@zoomtutorials www]#
[/simterm]