mkdir command
MkDir is used to create one or more directories
Grammar:
Grammar is
mkdir [command switch] Directory
Command switch:
-M |
Text directory set operation permissions |
-P |
If the parent directory does not exist, create them at the same time. |
-V |
Output information for each directory created by |
Example:
Create directory:
mkdir test
The above command creates the directory ' test '.
To create a directory and set access permissions:
Mkdir-m 666 Test
The above command creates the directory ' test ' and sets read and write permissions.
rmdir command
The rmdir command is used to delete/remove directories and their subdirectories.
Grammar:
Grammar is
rmdir [command switch ...] directory name
Command switch:
-P |
Allows the user to delete the dirname directory and delete it if the directory's upper-level directory has become an empty directory. |
Example:
Deletes/removes a directory.
RMDIR tmp
If the TMP directory is an empty directory, the rmdir command removes/deletes the TMP directory.
To delete a directory tree:
Rm-ir tmp
This command recursively deletes the contents of all subdirectories under the TMP directory, prompting you for deletion of each file, and then deleting the TMP directory itself.
CD command
The CD command is used to change the directory.
Grammar:
Grammar is
cd [Directory name | ~ |./| / | - ]
Command switch:
-L |
Use a tree-type directory structure. |
-P |
The mandatory signature connection. |
Example:
CD linux-Command This command (linux-command) changes from its parent directory to the subdirectory.
Cd.. This will change from the current working directory/subdirectory to the parent directory.
CD ~ This command will change to the user's home directory "/home/username"
PWD command
pwd– displays the working directory. The PWD command displays the absolute path name of the current working directory.
Grammar:
Grammar is
PWD [command switch]
Command switch:
-P |
Displays a pathname that does not contain a symbolic connection. |
-L |
Displays the path name that contains the symbolic connection. |
Example:
Displays the current working directory.
PWD If you work in the home directory, then the PWD command displays the current working directory as/home.
ls command
ls command files and directories in the current working directory.
Grammar:
Grammar is
LS [command switch] ... File
Command switch:
-l |
|
-t |
|
-a |
|
-d |
|
-p |
|
-u |
|
-i |
|
-ltr |
|
-LSR |
|
Example:
Displays the contents of the root directory:
LS/lists the contents of the root directory.
Show hidden files and directories:
LS-A lists all items, including hidden files and directories.
Display node Information:
ls-i7373073 Book.gif
7373074 Clock.gif
7373082 Globe.gif
7373078 Pencil.gif
7373080 Child.gif
7373081 Email.gif
7373076 Indigo.gif
The above command displays the file name and file size.