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

Os Task

This document outlines essential Linux commands for managing files and directories, including pwd, ls, mkdir, cd, touch, mv, cp, rm, nano, cat, and rmdir. Each command is accompanied by a brief description and its syntax. These commands facilitate navigation, file creation, modification, and deletion within the Linux operating system.

Uploaded by

physics11first
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 views4 pages

Os Task

This document outlines essential Linux commands for managing files and directories, including pwd, ls, mkdir, cd, touch, mv, cp, rm, nano, cat, and rmdir. Each command is accompanied by a brief description and its syntax. These commands facilitate navigation, file creation, modification, and deletion within the Linux operating system.

Uploaded by

physics11first
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/ 4

PRACTICAL NO: 5

Task 5: Commands for files & directories: cd, ls, cp, mv, rm, mkdir, rmdir.
Creating and viewing files using cat.

1. pwd command: In Linux, the pwd command stands for "Print Working Directory" and
is used to display the absolute path of the current directory in the command-line interface.
Syntax: pwd [option]

2. ls command: In Linux, the ls command is used to list the contents of a directory,


displaying files and directories within it.
Syntax: ls [option] [path/to/directory]

3. mkdir command: In Linux, the mkdir command, short for "make directory," is used
to create new directories (folders) in the file system.
Syntax: mkdir [options] directory_name

4. cd command: In Linux, the cd command, short for "change directory," is used to


navigate the file system, allowing users to move between different directories (folders)
from the command line.
Syntax: cd [directory]

2322687
5. touch command: The touch command in Linux is primarily used to create new, empty
files or update the timestamps (last modified and access times) of existing files.
Syntax: touch myfile. txt

6. mv command: In Linux, the mv command is used to move or rename files and


directories. It can also be used to move files to a different directory or rename them while
moving.
Syntax: mv [options(s)] [source_file_name(s)] [Destination_file_name]

7. cp command: The touch command in Linux is primarily used to copy the files within
the directories.
Syntax : cp [options] source destination

8. rm command: The rm (remove) command in Linux is used to delete files and directories
from the filesystem. It is a powerful command that operates permanently, meaning it does

2322687
not move files to a “trash” or “recycle bin” but removes them completely, making recovery
difficult without the use of specialized forensic software.
Syntax: rm [option] file

9. nano command: To start using Nano, you can simply type nano followed by the

filename in the terminal. If the file exists, Nano will open it for editing; if not, it will
create a new file with that name.
Syntax: nano example.txt

10. cat command: The cat command in Linux is used for displaying, concatenating
(combining), and creating text files. It reads one or more files and prints their contents to
the terminal, making it a quick way to preview or combine text data.
Syntax: cat [option] [file]

2322687
11. rmdir command: The rmdir command in Linux is used to remove empty directories.It
ensures that directories are empty before deleting them, preventing accidental data loss.
Syntax: rmdir directory_name

2322687

You might also like