Operating System Lab 5
Operating System Lab 5
2021
LAB 05
LINUX OPERATING SYSTEM
System Information Commands
Lab objective:
This lab introduces few of the system information commands of
Linux.
Also, man command, info command and command –help.
Df command:
The df command displays file system disk space usage for all mounted
partitions.
Df –h command:
"df -h" is probably the most useful - it uses megabytes (M) and gigabytes
(G) instead of blocks to report. (-h means "human-readable").
Du Command:
The du command displays the disk usage for a directory. It can either
display the space used for all subdirectories or the total for the directory
you run it on. Example:
echo
The "echo" command helps us move some data, usually text into a file.
For example, if you want to create a new text file or add to an already
made text file, you just need to type in, echo “hello, my name is xyz” >>
new.txt. You do not need to separate the spaces by using the backward
slash here, because we put in two triangular brackets when we finish what
we need to write.
Top ('table of processes') command:
The top ('table of processes') command displays information on your
Linux system, running processes and system resources, including CPU,
RAM & swap usage and total number of tasks being run. To exit top,
press "q".
htop command in Linux system is a command line utility that allows the
user to interactively monitor the system's vital resources or server's
processes in real time. htop is a newer program compared to top
command, and it offers many improvements over top command.
uname -a:
The uname command with the -a option prints all system information,
including machine name, kernel name & version, and a few other details.
Most useful for checking which kernel you're using.
Options
The default behavior for a command may usually be modified by adding
a --option to the command.
The ls command for example has an -s option so that "ls -s" will
include file sizes in the listing.
apt-get
Use apt to work with packages in the Linux command line. Use apt-get to
install packages. This requires root privileges, so use the sudo command
with it. For example, if you want to install the text editor jed, we can type
in the command “sudo apt-get install jed”. Similarly, any packages can be
installed like this. It is good to update your repository each time you try
to install a new package. You can do that by typing “sudo apt-get update”.
You can upgrade the system by typing “sudo apt-get upgrade”. We can
also upgrade the distro by typing “sudo apt-get dist-upgrade”. The
command “apt-cache search” is used to search for a package. If you want
to search for one, you can type in “apt-cache search jed”.