0% found this document useful (0 votes)
145 views10 pages

Os Practical 1

The document provides an overview of Linux and UNIX operating systems, detailing their history, advantages, and disadvantages. It also includes practical commands for Linux, such as mkdir, pwd, cd, and others, explaining their functions and usage. The document serves as a guide for users to understand basic Linux commands and their applications.

Uploaded by

sutariyakrish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views10 pages

Os Practical 1

The document provides an overview of Linux and UNIX operating systems, detailing their history, advantages, and disadvantages. It also includes practical commands for Linux, such as mkdir, pwd, cd, and others, explaining their functions and usage. The document serves as a guide for users to understand basic Linux commands and their applications.

Uploaded by

sutariyakrish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Subject Code: 3140702 Operating System

Practical : 1
AIM : Study of Basic commands of Linux/UNIX.

Linux/UNIX
Linux is an operating system that was developed by Linus Torvalds in 1991. The name “Linux” originates
from the Linux kernel. It is an open-source software that is completely free to use. It is used for computer
hardware and software, game development, mainframes, etc. It can run various client programs.
Unix is a portable, multi-tasking, bug-fixing, multi-user operating system developed by AT&T. It started as
a one-man venture under the initiative of Ken Thompson of Bell Labs. It proceeded to turn out to become
the most widely used operating system. It is used in web servers, workstations, and PCs. Many business
applications are accessible on it.
Advantages of Linux:
1. Free & Open Source: It’s free to use, and anyone can change it.
2. Secure: Less likely to get viruses.
3. Stable & Reliable: It doesn’t crash easily and works well for a long time.
4. Customizable: You can change almost everything.
5. Good for Old Computers: It runs smoothly on older hardware.
6. Easy Software Updates: Linux makes installing and updating software easy.
7. Community Support: There’s a big community to help you out.
Disadvantages of Linux:
1. Not All Software Works: Some popular apps like Adobe Photoshop or Microsoft Office aren’t
available.
2. Hardware Issues: Some devices (like printers or Wi-Fi adapters) may not work right away.
3. Harder for Beginners: It’s not as easy for new users compared to Windows or macOS.
4. Not Great for Gaming: Fewer games and some might not work well.
5. Limited Commercial Software: Many paid software programs don’t have Linux versions.

Mkdir Command -Make Directory


This mkdir command allows you to create fresh directories in the terminal itself. The default syntax
is mkdir <directory name> and the new directory will be created.

Pwd Command -Print Work Directory

230760107064 1
Subject Code: 3140702 Operating System
The pwd command is mostly used to print the current working directory on your terminal. It is also one of
the most commonly used commands.
-P :- The pwd command in Linux is used to display the current working directory, which is the directory
you are currently in.
-L :- Displays the logical current working directory, considering symbolic links.

Cd Command -Change Directory


The cd command is used to navigate between directories. It requires either the full path or the directory
name, depending on your current working directory.
cd .. :- Change Current directory to parent directory
cd ~ :- Move to users home directory from anywhere

Rmdir Command -Remove Directory


The Rmdir command is used to delete permanently an empty directory. To perform this command the user
running this command must be having sudo privileges in the parent directory.

Ls Command -List
The ls command is commonly used to identify the files and directories in the working directory. This
command is one of the many often-used Linux commands that you should know.
ls -l :- Use To show long listing information about the file/directory
ls -a :- List all files including hidden file starting with &#39;.&#39;
ls -r :- List in reverse order
ls -t :- Sort by time &amp; date

230760107064 2
Subject Code: 3140702 Operating System

Cal Command -Calendar


The cal command is not the most famous command in the terminal but it functions to view the calendar for
a particular month in the terminal. Let’s see how this works.
cal -s :- Display Sunday as the first day of the week.
cal -m :- Display Monday as the first day of the week.
cal -j :- Use day-of-year numbering for all calendars. These are also called
ordinal days. Ordinal days range from 1 to 366.
cal –y :- Display a calendar for the whole year

230760107064 3
Subject Code: 3140702 Operating System

Date Command
date command is used to display the system date and time. date command is also used to set date and time
of the system.
date +%A :- The full weekday name (e.g., Sunday)
date +%b :- The abbreviated month name (e.g., Jan)
date +%B :- Locale&#39;s full month name (e.g., January)
date +%C :- The current century; like %Y, except omit last two digit
date +%w :- day of week (0..6); 0 is Sunday

230760107064 4
Subject Code: 3140702 Operating System

Cat Command
The cat command is the simplest command to use when you want to see the contents of a particular file. The
only issue is that it simply unloads the entire file to your terminal.
cat -b :- Use Omits line numbers for blank space in the output
cat -E :- Displays a $ (dollar sign) at the end of each line
cat -n :- Line numbers for all the output lines
cat -s :- Suppress repeated empty output lines
cat -T :- Displays the tab characters as ^I in the output

Wc Command -Word Count


wc command in Linux indicates the number of words, characters, lines, etc using a set of options.

wc -l :- Use Prints the number of lines in a file


wc -w :- Prints the number of words in a file
wc -c :- Displays the count of bytes in a file
wc -L :- Prints only the length of the longest line in a file

230760107064 5
Subject Code: 3140702 Operating System

Uname Command -User Name


The uname command is used to check the complete OS information of the system.
uname -s :- Print the kernel name
uname -n :- Print the network node hostname
uname -v :- Print the kernel version
uname -m :- Print the machine hardware name

Who Command
The who command displays the following information for each user currently logged in to the system if
no option is provided.
-p :- Shows active processes spawned by init.
-q :- Displays only the logged-in users and their count.
-s :- Shows the default short who command output.
-t :- formats the display of output on the terminal screen.

whoami Command
The whoami command provides basic information that is extremely useful when working on multiple
systems. In general, if you are working with a single computer, you will not require it as frequently as a
network administrator.
whoami –help :- Use Display a help message, and exit
whoami --version :- Display version information, and exit

230760107064 6
Subject Code: 3140702 Operating System

Cp Command -Copy
The cp command of Linux is equivalent to copy-paste and cut-paste in Windows.
cp -I :- Use Interactive - ask before overwrite
cp -n :- Do not overwrite an existing file
cp -u :- Update - copy when source is newer than destination
cp -v :- Print informative messages

echo Command
echo command in Linux is specially used to print something in the terminal.

echo -n :- Use Do not output a trailing newline


echo -e :- Enable interpretation of backslash escape sequences
\b :- Use It removes all the spaces in between the text
\n :- It creates new line from where it is used
\t :- It create horizontal tab spaces

Mv Command -Move
The mv command is generally used for renaming the files in Linux.
mv -I :- Use Interactive prompt before overwrite
mv -f :- Force move by overwriting destination file without prompt
mv -n :- Never overwrite any existing file
mv -u :- Update - move when source is newer than destination
mv -v :- Print informative messages

230760107064 7
Subject Code: 3140702 Operating System

Rm Command -Remove
rm command in Linux is generally used to delete the files created in the directory.

rm -I :- Use Prompt before every removal


rm -d :- Delete a empty directory
rm -r :- Remove directories and their contents recursively
rm -f :- To remove the file forcefully

Nl Command
nl command is a Unix/Linux utility that is used for numbering lines, accepting input either from a file or
from STDIN.
nl -I :- Use Line number increment at each line
nl -s :- Add STRING after (possible) line number
nl -w :- Use NUMBER columns for line numbers

230760107064 8
Subject Code: 3140702 Operating System

Ln Command
The ‘ln’ command in Linux is a powerful utility that allows you to create links between files. These links
can either be hard links or soft (symbolic) links.
-s, a stat call on a symbolic link returns the linked-to file;
-n, specifies that if the link is an existing file, do not overwrite the contents of the file.
ln -f :- Use If the destination file or files already exist, overwrite them
ln -i :- Prompt the user before overwriting destination files
ln -s :- Make symbolic links instead of hard links

Head Command
The head command, as the name implies, print the top N number of data of the given input. By default, it
prints the first 10 lines of the specified files.
head -n :- Use Print the first n lines instead of the first 10; with the leading &#39;-&#39;,
print all but the last n lines of each file
head -c :- Print the first n bytes of each file; with a leading &#39;-&#39;, print all but
the last n bytes of each file
head -q :- Never print headers identifying file names

Tail Command
The tail command, as the name implies, prints the last N number of data of the given input. By default, it
prints the last 10 lines of the specified files.
tail -n :- Use Output the last num lines, instead of the default (10)
tail -c :- Output the last num bytes of each file
tail -q :- Never output headers

230760107064 9
Subject Code: 3140702 Operating System

History Command
The history command is a valuable utility that allows users to view and search through their command
history. In this comprehensive guide, enabling users to streamline their workflow and save time by
efficiently accessing and reusing commands.

230760107064 10

You might also like