Experiment 02
Aim
To study basic Linux terminal commands for system navigation and directory management.
Theory
-
pwd(Print Working Directory)- Prints the full filename of the current working directory
- Syntax: pwd [options]
-
cd(Change Directory)- Used to change the directory
- Syntax: cd [directory | ~ | ./ | ../ | -]
-
ls(List)- Lists the files and directories under current working directory
- Syntax: ls [OPTIONS]... [FILE]
- Options:
-l lists all the files, directories and their mode, Number of links, owner of the file, file size, Modified date and time and filename
-a lists all entries including hidden files
-t lists in order of last modification time
-d lists directory files instead of contents
-
mkdir(Make Directory)- Used to create one or more directories
- Syntax: mkdir [options] directories
- Options: -p creates intervening parent directories if they don't exist
-
rmdir(Remove Directory)- Used to delete/remove a directory and its subdirectories
- Syntax: rmdir [options..] Directory
Commands
$ pwd
/home/student/workspace
$ mkdir -p dir1/subdir1
$ cd dir1/subdir1
$ pwd
/home/student/workspace/dir1/subdir1
$ cd ../..
$ ls -l
drwxr-xr-x 3 student student 4096 Mar 19 14:00 dir1
$ ls -a
. .. .hidden_config dir1
$ rmdir dir1/subdir1
$ rmdir dir1
Conclusion
The fundamental Linux terminal commands for determining the current path (pwd), navigating the file system (cd), listing directory contents with various detailed options (ls), and managing directory structures (mkdir, rmdir) were successfully studied and executed