0% found this document useful (0 votes)
6 views

Basic Command of Unix

The document provides an overview of the Linux/UNIX operating systems, highlighting their open-source nature, security, stability, and customization options. It details the components of Linux, such as the kernel, system libraries, shell, hardware layer, and system utilities, as well as a list of basic commands with their functionalities. Additionally, it discusses the advantages and disadvantages of using Linux, including compatibility issues and a steep learning curve for beginners.

Uploaded by

shrutishekhada28
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Basic Command of Unix

The document provides an overview of the Linux/UNIX operating systems, highlighting their open-source nature, security, stability, and customization options. It details the components of Linux, such as the kernel, system libraries, shell, hardware layer, and system utilities, as well as a list of basic commands with their functionalities. Additionally, it discusses the advantages and disadvantages of using Linux, including compatibility issues and a steep learning curve for beginners.

Uploaded by

shrutishekhada28
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Subcode: 3140702 Enrollment no.

: 230760107131

Practical – 1
aim: Study of Basic commands.

What is Linux/UNIX?

Linux/UNIX is operating systems (OS) that allow users to perform multiple tasks on their
computers.

It is open-source, so anyone can view, modify, and share its code. Linux can run multiple programs
at once and allow several users to work on the system simultaneously. It is secure, with features that
protect your data. Linux works on many different types of hardware and is known for being stable,
rarely crashing. You can customize it to fit your needs. It also has tools for networking and
installing/updating software easily. Plus, there’s a large community that offers support and helps
improve Linux.

Linux offers several advantages, such as being open-source and free to use, which allows users to
access and modify the source code. It is known for its strong security features, stability, and
reliability, making it ideal for servers. Linux is highly customizable to suit specific needs and
performs well even on older hardware. Additionally, it has a large, active community that provides
support and updates. However, there are also some drawbacks. Compatibility issues can arise with
certain software and hardware, and Linux may not support some proprietary programs. The learning
curve can be steep for beginners, especially when using the command-line interface. There is also
limited availability of commercial software, and installing some programs can be more complicated
compared to other operating systems. Gaming support on Linux is improving but still lags behind
Windows.

Linux operating system has the following components:


1. Kernel: The core of the system, responsible for managing hardware resources and ensuring
smooth communication between processes. Types of kernels include monolithic, hybrid, exo, and
microkernels.

2. System Libraries: Pre-written code that applications use to perform tasks, acting as a bridge
between the kernel and applications for efficient interaction.

3. Shell: A user interface that allows users to interact with the system by entering commands,
which are executed by the kernel.

4. Hardware Layer: Includes the physical components of the computer (e.g., CPU, RAM, HDD),
enabling the operating system to function by providing necessary resources.

5. System Utilities: Essential tools for managing and configuring the system, such as installing
software, configuring networks, and monitoring performance. They simplify system administration
tasks.

Here, there are some basic commands of Linux/UNIX :

1. cd :
(a) cd..  Change Current directory to parent directory

(b) cd ~  Move to users home directory from anywhere

(c) cd lab_1  Change from current working directory to lab_1


2. ls :
(a) ls -l To show long listing information about the file/directory

(b)ls -a  List all files including hidden file starting with ‘.’

(c) ls -r  List in reverse order


2. man  It is the interface used to view the system’s reference manuals

3. echo  Display a line of text/string on standard output or a file

(a) echo -n Do not output a trailing newline

(b) echo -e  Enable interpretation of backslash escape sequences


(i) /b  It removes all the spaces in between the text
(ii) /n  It creates new line from where it is used
(iii)/t  It create horizontal tab spaces
4. cal  Displays a simple, formatted calendar in your terminal

(a) cal -1 Display single month output (This is the default)


(b) cal -3 Display three months spanning the date
(c) cal -h  It will no highlight the date
(d) cal -N  It will show calendar in ncal

5. date Print or set the system date and time


(a) date +%a  The abbreviated weekday name (e.g., Sun)
(b) date +%A  The full weekday name (e.g., Sunday)
(c) date +%B  Locale’s full month name (e.g., January)
(d) date +%H  Display the hour
6. cat  It is used to create, display and concatenate file contents
(a) cat -b  Omits line numbers for blank space in the output
(b) cat -E  Displays a $ (dollar sign) at the end of each line
(c) cat -s  Suppress repeated empty output lines
(d) cat -n  Line numbers for all the output lines

7. pwd  It prints the current working directory name with the


complete path starting from root (/)

8. who It display the users that are currently logged into your Unix
computer system
(a) who -b  Display the time of the last system boot
(b) who -H  Print a line of column headings
(c) who -q  Displays all login names, and a count of all logged-on users
(d) who -a  Display all details of current logged in user
9. whoami  This command prints the username associated with the current
effective user ID
(a) whoami - -help  Display a help message, and exit
(b) whoami - -version  Display version information, and exit

10. uname  Print information about the current system.


(a) uname -s  Print the kernel name
(b) uname -n  Print the network node hostname
(c) uname -v  Print the kernel version
(d) uname -m  Print the machine hardware name
11. mkdir  This command is used to make Directories.
(a) mkdir -v  Print a message for each created directory
(b) mkdir -p  No error if existing, make parent directories as needed
(c) mkdir -m  To control the permissions of new directories

12. rmdir This command removes empty directories from your filesystem
13. cp  This command is used to copy files and directories.
(a) cp -i  Interactive - ask before overwrite

(b) cp -v  Print informative messages


(c) cp -s  Make symbolic links instead of copying
(d) cp -f  Force copy by removing the destination file if needed

14. mv  mv command is used to move files and directories


(a) mv -f  Force move by overwriting destination file without prompt
(b) mv -n  Never overwrite any existing file
(c) mv -v  Print informative messages

15. rm  to delete files and directories.


(a) rm -d  Delete a empty directory
(b) rm -f  To remove the file forcefully
16. paste  The paste command displays the corresponding lines of multiple
files side-by-side
(a) paste -d  Reuse characters from LIST instead of tabs
(b) paste -s  Paste one file at a time instead of in parallel
17. wc  It s used to find out number of newline count, word count, byte
and characters count in a files specified by the file arguments
(a) wc -l Prints the number of lines in a file
(b) wc -w Prints the number of words in a file
(c) wc -L Prints only the length of the longest line in a file

18. ln  creates links between files


(a) ln -s  Make symbolic links instead of hard links

19. nl  numbers the lines in a file


(a) nl -i  Line number increment at each line
(b) ni -s  Add STRING after (possible) line number
(c) nl -w  Use NUMBER columns for line numbers

20. head  easy to output the first part (10 lines by default) of
files
(a) head -n  Print the first n lines instead of the first 10; with the leading ‘-‘,
print all but the last n lines of each file

21. tail  prints the last few number of lines (10 lines by default) of a certain file, then
terminates
(a) tail -n  Output the last num lines, instead of the default (10)
(b) tail -c  Output the last num bytes of each file
(c) tail -q  Never output headers

22. history  to view the previously executed command

You might also like