Os Task
Os Task
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]
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
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
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