T.Y.B.Sc.(I.T.
)-SEM V Linux System Administration Roll No: 53
Installation
1. Open the VMware workstation.
2. Click on create a new Virtual Machine.
3. Select Typical & Click on the next button.
4. Select I will install operating system later option and click on next button
5. Select Linux version Red Hat Enterprise Linux 8 64-bit
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
6. Name the virtual machine Red Hat Enterprise 8 64-bit 2 & give location
7. Give the maximum disk size 30 GB and select the split virtual disk into multiple files.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
8. Check the hardware information and then click on customized hardware button.
Virtual machine setting panel will get open. From there in CD/DVD add iso file of
rhel8 and then click on finish.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
9. Once the virtual machine is created click on power on virtual machine option which is
on left hand side.
10. Select the installation language as English English (India).
11. In installation destination, select I will configure partitioning
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
12. Manual partitioning screen will appear. Select LVM partition as partition type.
13. Click on ‘+’ button to add new partitions. Add a new mount point pop-up will appear.
Chose respective mount point and its size. Create 4 partitions i.e. /, /boot, /home andswap of
size 20GB,500MB,4GB and 4GB respectively
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
14. Set date and time.
15. Now in software selection, select Server with GUI and select all the packages under
this option except smart card support
16.Once installation is started user screen will appear where we need to set root password
and create local user.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
17. Create a local user Student with password as redhat.
18. Once package installation is completed reboot button will appear. Click on reboot button
to restart system.
19. After reboot, accept license agreement and click on finish configuration.
20. Now login screen will appear. Login as a root user.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
Practical No. 1
General Purpose Utility Commands
1.tty
This command is used to display the current terminal.
2.pwd
This command prints the current working directory.
3.date
It is used to display the date and time.
4.date -s
It is used to set the particular date and time.
5.who
Used to display all the logged in users and their terminals.
6.whoami
Used to know the current username.
7.uname -r
Used to check the kernel version.
8.w
To display all logged in users and what they are doing , information about the users currently
on the machine and their processes.
9.watch
Used for live monitoring.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
10.clear
Used for clearing the terminal screen.
11.cal
This command is used to display the current month calendar.
12.cal -3
To display the calendar of current, previous and next month.
13.cal -2017
To display the calendar of the year 2017.
14.history
To display the history of commands.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
15.users
This command is used to know who all are currently logged in.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
A. File Management Commands
1. ls
It is used to list the names of directories and files.
2. ls -l
It shows a long list of files and directories.
3. ls -lh
Provides the long list of files and directories in human readable form.
4. l .
Displays hidden files.
5. ls -a
This command lists all files.
6. ls - il
This command gives a long list of files and directories with inode numbers.
● To Create a Directory
7. mkdir dir1
This command is used to create a new directory dir1.
8.mkdir dir2/dir3
It is used to create a directory within a directory.
● To create an empty file
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
9. touch demo.txt
This command is used to create a single file in the current working directory.
10. touch TYIT-L/LSA/pract1.txt
This command is used to create a file pract1.txt in the directory TYIT-L/LSA.
● To Remove a Directory
11. rmdir dir1
This command is used to remove an empty directory.
12. rmdir -rf/month
This command is used to remove directories that contain subdirectories.
● The “cat” command
13. cat demo.txt
This command is used to display the contents of a file.
14. cat > demo.txt
Creates a new file and allows you to type content in it.
15. cat >> demo.txt
Used to append some data into the file.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
● To Copy Files
16. cp /dir1/file1.txt /dir2
Used to create a copy of file1.txt into /dir2.
17. cp /root/*.cfg /month/jan
Used to copy all the files ending with .cfg from root to /month/jan.
● To Move Files and Directories
18. mv /root/abc.txt /root/music
Move file abc.txt into the music directory.
19. mv /home/alpha /tmp
Move /alpha directory to /tmp.
● The “grep” command
20. grep spool /etc/passwd/new.txt
Used to search into a file. It searches for the word ‘spool’ in the file new.txt.
21. grep -i ‘bar’ new.txt
Performs a case insensitive search for the word ‘bar’ in the file new.txt.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
● To Sort Command - arrange lines of text files in a specific order — alphabetical or
numerical, ascending or descending.
22. sort new.txt
It sorts the file in character sort format by default.
23. sort -r new.txt
It sorts the contents of the file in reverse order.
24. sort -n new.txt
Performs the numerical sort.
● To Read a File using Head and Tail command
25. head new.txt
It displays the first 10 lines of the file by default.
26. head -n new.txt
It displays the first n number of lines from the file new.txt.
27. tail new.txt
It displays the bottom 10 lines of the file by default.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
28. tail -n new.txt
It displays the last n number of lines from the file new.txt.
● Word Count
29. wc new.txt
This command in Linux stands for word count — it's used to count lines, words, characters,
and bytes in a file or input.
30. wc -w new.txt
Displays the number of words in the file.
31. wc -L new.txt
Displays the length of the longest line.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
B. find Command
1. find . -name new.txt
Finds all the files whose name is new.txt in the current working directory.
2. find / -type d -name month
Finds all the directories whose name is month and is there in the / directory.
3. find . -type f -name abc.txt
Finds the abc.txt file in the cwd.
4. find . -type f -name “*.php”
Lists down all the files in the current working directory with the “.php” extension.
5. find /tmp -type f -empty
Finds all the empty files under /tmp directory.
6. find /etc -name “[a-g]*.conf”
Finds files starting with [a-g] and ending with “.conf”.
7. find /tmp -name “???”
Finds files containing only three characters in their name.
8. find /usr/bin -size +4M
Finds files with size greater than 4MB.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
C. Soft link and Hard link
1. ln /etc/hosts
A hard link is like creating another name for the same file. It points directly to the file’s data
on disk (inode), so even if the original file is deleted, the hard link still works. Created using
the ln command without the -s option.
2. ln -s /etc/hosts
A soft link is like a shortcut to another file. It just points to the original file’s name and location.
If the original file is deleted or moved, the soft link stops working. Created using the ln -s
command.
3. ln -s /home/tmp
Creates a symbolic link to the directory /home in the directory /tmp.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
D. Archiving and Compression
1. tar -cvf tardemo.tar /etc/passwd /etc/shadow
This command creates a tardemo.tar archive containing the /etc/passwd and /etc/shadow
files, and shows the progress on the screen.
2. tar -tvf tardemo.tar
This command displays a detailed list of all files stored in the tardemo.tar archive without
extracting them.
3. tar -xvf tardemo.tar
This command extracts all the files from the tardemo.tar archive and shows the names of
files as they are being extracted.
4.bzip2 tardemo.tar
This command compresses the tardemo.tar archive using bzip2 and replaces it with a new
file named tardemo.tar.bz2.
5. bzcat tardemo.tar.bz2
This command displays the raw contents of the compressed tar archive (tardemo.tar.bz2)
directly to the terminal without extracting it.
6. bunzip2 tardemo.tar.bz2
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
This command decompresses tardemo.tar.bz2 and restores it back to tardemo.tar.
7. gzip tardemo.tar
This command compresses tardemo.tar and replaces it with tardemo.tar.gz.
8.zcat tardemo.tar.gz
Displays the raw contents of the compressed file tardemo.tar.gz to the terminal without
extracting it.
9. gunzip tardemo.tar.gz
This command decompresses tardemo.tar.gz and restores the original file tardemo.tar.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
E. Input and Output Redirection
Input Redirection :
1. wc < demo_file.txt
Input redirection takes the content of a file and redirects it to a command.
By redirecting a text file “demo_file” to the wc command you can get a quick count of the
lines, words , bytes in the file.
Output Redirection :
2. date > demo.txt
Output of all the commands is by default printed on terminal using output redirection , we can
redirect output of any command to find.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
F. Vi Editor
1. vim demo.txt:
Enter in VIM editor mode
2. i,a:
Command mode to input mode
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
3. o:
Opens new line & goes to input
4. :q!
Quits without applying any changes
5. :w filename writes current file with a new filename
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
6. :wq
Write current files & quits
7. :dd
Deletes current line
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
8.: yy
Copies current line
9. v:
Enters Visual mode
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
10. u:
Undoes last command
11. Ctrl + r:
Redoes last command
12. gg: Goes to first line of file
13.G: Goes to last line of file
14. /hi: Searches for hi forward
15. ?hi: Searches for hi backward
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
16. 1: Goes to 1st position of first line
17. $: Goes to last position in current line
18. !ls: Adds o/p of ls in current file
19. s/learning /learn/g: Replaces old occurrences of old with new
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
Practical No.2 Process management Commands
1. ps : The ps (process status) command is used to display currently running processes
on your system.
2. top : The top command shows a live, real-time view of system processes,
CPU/memory usage, and system load.
3. renice : The renice command is used to change the priority (nice value) of a running
process.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
For stopping a Process:
1. kill <PID> : It sends a termination signal (SIGTERM by default) to gracefully stop
the specified process.
2. killall -SIGTERM httpd : It sends the SIGTERM signal to all processes named
httpd, requesting them to terminate gracefully.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
Practical No. 3
RPM and YUM Commands
1. RPM Commands
1. rpm -q httpd : It queries the system to check if the httpd package is installed and
shows its version if found.
2. rpm -qc httpd : lists all configuration files installed by the httpd package.
3. rpm -q –scripts httpd : It displays the installation, removal, and other scriptlets
(like preinstall, postinstall, preuninstall, postuninstall) used by the httpd package.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
4. rpm -qR httpd : lists all dependencies and required capabilities (like libraries,
config files, or other packages) that the httpd package needs to run properly.
5. rpm -V httpd : It verifies the integrity of the installed httpd package by checking
for changes in its files (size, permissions, checksum, etc.) against the original
metadata.
6. rpm -qa : Lists all installed RPM packages on the system.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
7. rpm -q dhcp : rpm -q dhcp checks if the dhcp package is installed on the system and
displays its name and version if found.
8. rpm -qf /etc/passwd : This command checks which installed RPM package owns
the file /etc/passwd.
9. rpm -ql httpd : Lists all files installed by the httpd package (like binaries, config
files, docs, systemd service units, etc.).
10. rpm -qi httpd : Displays detailed information about the installed httpd package.
2. YUM Commands
1. lsblk : Displays information about all available block storage devices (disks, SSDs,
partitions) in a tree-like format without showing empty devices by default.
2. mount /dev/sr0 /mnt : This command attaches the CD/DVD drive device file
/dev/sr0 to the /mnt directory in the Linux filesystem hierarchy, making the contents
of the disc accessible from that directory until it is unmounted.
3. cd /etc/yum.repos.d : Changes the current working directory to
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
/etc/yum.repos.d, which contains repository configuration files (.repo) used by
YUM/DNF to locate and download packages.
4. vim AppStream.repo : Opens the AppStream.repo file (a YUM repository
configuration file) in the Vim text editor so you can view or edit repository settings
for the AppStream package source.
T.Y.B.Sc.(I.T.)-SEM V Linux System Administration Roll No: 53
5. vim BaseOs.repo : Opens the BaseOs.repo file (a YUM repository configuration
file) in the Vim text editor so you can view or edit repository settings for the BaseOS
package source.
6. dh -h : Displays the disk space usage of all mounted filesystems in a human-readable
format (sizes shown in KB, MB, or GB).
7. yum repolist : Shows a list of all enabled YUM repositories along with their IDs,
names, and number of available packages.
8. yum install dhcp * : Installs all available packages whose names start with dhcp
from the enabled YUM repositories.