You are on page 1of 11

Redhat Certified System Administrator

Technology Course RH-124


(RHCSA)

BY- Ankit Shukla


Basic Concepts of Linux

• Physical Console: - The hardware display and keyboard used to


interact with a system.

• Virtual Console: - One of multiple logical consoles that can each


support an independent login session.

• Terminal: - An interface that provides a display for output into a shell


by taking input from keyboard.
Basic Concepts of Linux
Run Levels of Linux-

• Init 0 – shutdown / halt


• Init 1 – Single user mode
• Init 2 – Multi user mode without network and GUI
• Init 3 – Multi user mode with network and Without GUI
• Init 4 – Not in USE
• Init 5 - Multi user mode with network and GUI / X11
• Init 6 – restart

[root@srv ~]# runlevel “To Show Run level of Machine”


Basic Commands of Linux
[root@srv ~]# whoami "show current user login“
[root@srv ~]# echo $SHELL "show your default shell”
[root@srv ~]# exec /bin/tcsh “Change your default shell temporary”
[root@srv ~]# echo $0 "show your shell user login”
[root@srv ~]# uname –a “O.S name, version, kernel and other info”
[root@srv ~]# hostname or hostnamectl “ show hostname related info”
[root@srv ~]# hostnamectl set-hostname SERVER “Set hostname”
[root@srv ~]# reboot “After set hostname system must be reboot”
[root@srv ~]# cal “To show calendar”
[root@srv ~]# cal 08 2015 “Show calendar particular month”
[root@srv ~]# date “Show date and time both but this old command”
[root@srv ~]# timedatectl “Show date and time with more info ”
Basic Commands of Linux
[root@srv ~]# timedatectl list-timezones “show timezone list”
[root@srv ~]# timedatectl set-timezone "Asia/Kolkata“ “set time zone”
[root@srv ~]# timedatectl set-timezone UTC “set time zone”
[root@srv ~]# timedatectl set-ntp false “Disable time sysnchronization”
[root@srv ~]# timedatectl set-ntp true “Enable time sysnchronization”
[root@srv ~]# timedatectl set-time 04:16:20 HH:MM:SS “To Set time”
[root@srv ~]# timedatectl set-time 2018-06-20 Y-M-D “To Set Date”
[root@srv ~]# mkdir Dirname “To make Directory”
[root@srv ~]# mkdir /root/Desktop/Dir-1 “Create Dir another location”
[root@srv ~]# mkdir dir1 dir2 dir3 “Create separate multiple Dir.”
[root@srv ~]# mkdir -p -v dir/dir4/dir5 “Create Directory tree”
[root@srv ~]# touch file.txt “Create empty file”
[root@srv ~]# touch file1.txt file2.txt “Create multiple file”
Basic Commands of Linux
[root@srv ~]# mkdir –m 444 dirname “create dir with permission”
[root@srv ~]# pwd “To show present working directory”

• Brace Expansion
Brace expansion is used to generate flexible strings or character.
[root@srv data]# mkdir {1..8}
[root@srv data]# touch {1..8}.txt
[root@srv data]# touch {a..z}.{txt,mp3}
[root@srv data]# touch {a..c}{1..3}.{txt,mp3}
[root@srv data]# touch {a{1..3},b,c}.{txt,mp3}
[root@srv data]# mkdir {a,b,c,{1..5}}
[root@srv data]# mkdir {{1..9},{a..g}}
Basic Commands of Linux
[root@srv ~]# cd “change to the user’s home directory.”
[root@srv ~]# cd /root/Desktop/ “Change the directory”
[root@srv Desktop]# cd .. “to move back one directory from the current
directory.”
[root@srv ~]# cd ../.. “move back two directories from the current
directory.”
[root@srv ~]# ls “list directory contents”
-a “do not ignore entries starting with .”
-lh “shows file or directory, size human readable, modified date
and time, file or folder name and owner of file and its permission.”
-R “option will list very long listing directory trees.”
-lrt “shows latest modification file or directory date as last.”
-n “To display UID and GID of files and directories.”
[root@srv ~]# ls -ld /tmp/ “Show specific directory info”
Basic Commands of Linux
[root@srv ~]# cat abc.txt “Show the content of file”
[root@srv ~]# file as.txt “To identify the file type”
[root@srv ~]# head /etc/passwd “Show file content from starting 10 line”
[root@srv ~]# head -n 20 /etc/passwd “you can define no of line display”
[root@srv ~]# tail /etc/passwd “Show file content from ending 10 line”
[root@srv ~]# tail -n 20 /etc/passwd “you can define no of line display”
[root@srv ~]# wc as.txt “Count the no of word, line character”
-l = Lines counts
-w = Word counts
-c = Character counts
[root@srv ~]# history “To show the history of commands”
Note- history are stored into “.bash_history” file. It can contain up to
5000 commands.
I/O Pipes Redirection
• Standard Input (Channel 0) reads input from the keyboard.
• Standard Output (Channel 1) sends normal output to the terminal.
• Standard Error (Channel 2) sends error massages to the terminal.
 STDIN Examples-
“<“ = redirect input in a file
cat < file-name
[root@srv ~]# cat < a.txt
mail –s “Subject” username < file-name
[root@srv ~]# mail -s "hello world" root < /root/file.txt
cat > “file-name” <<“end with some character or word”
I/O Pipes Redirection
 STDOUT Examples-
> = redirect output to overwrite a file.
>> = redirect output to append a existing file.
[root@srv ~]# df -hT > as.txt
[root@srv ~]# ll >> as.txt

 STDERR Examples-
2> = redirect output to overwrite a file.
2>> = redirect output to append a existing file.
[root@srv ~]# ll /etcw 2> err.txt
Thank you

BY- Ankit Shukla

You might also like