0% found this document useful (0 votes)
10 views14 pages

Pra1

The document provides an overview of the Unix operating system, detailing its components, features, and basic commands. Key features include multiuser support, multitasking, security, and portability. It also lists various commands such as 'cd', 'ls', 'man', and 'echo', along with their usage and options.

Uploaded by

bhikadiyadiya171
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)
10 views14 pages

Pra1

The document provides an overview of the Unix operating system, detailing its components, features, and basic commands. Key features include multiuser support, multitasking, security, and portability. It also lists various commands such as 'cd', 'ls', 'man', and 'echo', along with their usage and options.

Uploaded by

bhikadiyadiya171
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/ 14

Operating System [3140702] 240763107002

Practical:- 1

Aim:- Study of Basic commands of Linux/UNIX

 What is Unix operating system?


- Unix is a portable, multitasking, multiuser, time-sharing operating system originally
developed by AT&T Bell Labs.
- The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X.
- The UNIX operating system is made up of three parts : kernal, shell and application
- Kernal allocates time and memory to programs and handles the filestore and
communications in response to system calls.
- The shell acts as an interface between the user and the kernel.

 Linux architecture

 Feature:
- Multiuser support: UNIX allows multiple users to simultaneously access the same
system and share resources.
- Multitasking: UNIX is capable of running multiple processes at the same time.
- Security: UNIX has a robust security model that includes file permissions, user
accounts, and network security features.
- Portability: UNIX can run on a wide variety of hardware platforms, from small
embedded systems to large mainframe computers.

Page | 1
Operating System [3140702] 240763107002

 Commands:-
1. cd:- Change Directory
Usage:- The cd command is used to change the current directory.

Options:-

- cd .. : To navigate up one directory level


- cd / : change the directory to the root directory.

2. Ls:- List Files


Usage:- list out contents of a directory.

Options:-

- -l : displays detailed information about files and directories.

- -a : Represent all files Include hidden files and directories.

- -r: List in reverse order .

- -i: It known as inode which displays the index number (inode) of each file and directory.

3. man:
Usage:- Print entries from the on-line reference manuals; find manual entries by
keyword.

Page | 2
Operating System [3140702] 240763107002

4. echo:
Usage:- Displays message, as well as evaluates variables.

Options:-

- \v: This option is used to create vertical tab spaces.

- -n: Do not output a trailing newline.

- \n : creates new line from where it is used.

5. cal:- Calendar
Usage:- Display Calendar

Page | 3
Operating System [3140702] 240763107002

Options:-

- cal -3: Shows calendar of previous, current and next month.

- cal [year]: Shows the whole calendar of the year.

- cal -j: Shows the calendar of the current month in the Julian calendar format not in the
default Gregorian calendar format.

6. date:
Usage:- Displays current date and time.

Options:-

- +d%: Display the day of the month.


- +m%: Display the month of year.
- +y%: Displays last two digits of the year.

Page | 4
Operating System [3140702] 240763107002

7. clear:
Usage:- command to clear the terminal in Linux.

8. cat:
Usage:- Displays file contents, creates new file, or appends data to an existing file.

Options:-

- cat -e: This command shows end-of-line characters ($) at the end of each line.

- cat file_name1 >> file_name2: If you want to add the content of one file to another,
‘cat’ can be used along with the append (>>) operator.

- cat -n: This command is used to displays the contents of a file with line numbers.

Page | 5
Operating System [3140702] 240763107002

9. pwd:- Print Working Directory


Usage:- Print Working Directory name.

Options:-

- -L: This command shows the current working directory as a logical path.

- -P: This command shows the current working directory as a physical path.

10. who:
Usage:- Displays Login name of the users, Terminal line numbers, Login time of
the users into the system, The remote host name of the user.

Options:-

- -b: Shows the last system boot time.


- -H: Displays column headers for the output.

- -l: Lists system login processes.


- -a: Displays all available information, including boot time, login processes, and user
details.

11. whoami:
Usage:- Displays user of the current shell only.

Page | 6
Operating System [3140702] 240763107002

- whoami --help: Display a help message, and exit.


- Whoami --version: Display version information, and exit.

12. uname:
Usage:- This command in Linux displays system information.

Options:-

- -s: It prints the kernel name.


- -n: It prints the hostname of the network node.
- -v: It prints the version of the current kernel, including the build date and time.
- -r: It prints the kernel release date.

13. passwd:
Usage:- It is used to change a user's password.
Syntax:- passwd [-options] [username]

14. mkdir: Make Directory


Usage:- Create new directory

Options:-

- -v: Displays a message for each directory created.

Page | 7
Operating System [3140702] 240763107002

- -p: Creates parent directories if they don’t exist.

- -m: Sets permissions for the directory during creation.

15. rmdir: Remove Directory


Usage:- Removes an empty directory. If the directory is not empty, it will not be
removed.

Options:-

- -p: remove DIRECTORY and its ancestors.

16. cp: Copy Command


Usage:- Copies a file or group of files.

Options:-

- -i: Interactive copying (ask before overwriting a destination file).


- -r: Recursive copying (it copies directory structure).

Page | 8
Operating System [3140702] 240763107002

- -f: Forces overwriting of destination files without confirmation.

17. mv: Move / Rename file


Usage:- rename a file or moves a file or group of files.

Options:-

- -i: Prompts for confirmation before overwriting files.

- -f: Forces overwriting of files without confirmation.

- -b: Creates a backup of the destination file before overwriting.

18. rm: Remove file


Usage:- removes files.

Options:-

- -i : prompt before every removal

- -f : ignore non existent files and arguments, never prompt

- -d : remove empty directories

Page | 9
Operating System [3140702] 240763107002

19. cut:
Usage:- cut a file vertically. Extract specific columns or fields from an input file.

Options:-

- cut -b: Extracts specific bytes.

- cut -f: cut by field with space as a field separator or delimiter option.

- cut -c: selects only the characters specified.

20. paste:
Usage:- It allows users to merge multiple files or lines of text into a single output.

Options:-

- paste -d: This option specifies a delimiter to combine lines from files.

Page | 10
Operating System [3140702] 240763107002

- paste -s: Combines lines from a file horizontally.

21. wc: Remove Directory


Usage:- Counts number of character, words and lines in an given input file.

Options:-

- -c: counts number of character.

- -m: Counts the number of characters in a file.

- -l: Counts the number of lines in a file.

- -L: Finds the length of the longest line in a file.

22. ln:
Usage:- It creates symbolic links between files.

Options:-

- -s: It Creates a symbolic link to a file or directory.

Page | 11
Operating System [3140702] 240763107002

- -f: Forces overwriting of an existing link.

- -i: This command prompts for confirmation before overwriting an existing file or link.

23. nl:
Usage:- The is used to add line numbers to the contents of a file or input.

Options:-

- -s: It allows you to specify a separator between the line number and the content of the
line.

- -d: numbers the lines in the input, and writes the numbered lines to standard output.

- -i: It allows you to set the increment for the line numbers.

Page | 12
Operating System [3140702] 240763107002

24. head:
Usage:- Display top of the line. default, it display first 10 lines of file.

Options:-

- -n: Prints the first ‘num’ lines instead of first 10 lines.

- -c: Prints the first ‘num’ bytes from the file specified.

- -v: data from the specified file is always preceded by its file name.

25. tail:
Usage:- Display end of the line. default, it display last 10 lines of file.

Options:-

- -n: Prints the last ‘num’ lines instead of last 10 lines.

- -c: Prints the last ‘num’ bytes from the file specified.

Page | 13
Operating System [3140702] 240763107002

- -q: This command hides the file names when showing the last part of multiple files.

Page | 14

You might also like