[Linux basic] Creating and deleting Linux directories
The mkdir used to create one or more directories
The above command will create the directory ‘ddos’.
Create a directory and set access permissions:
mkdir -m 777 ddos
The above command will create the directory ‘ddos’ and set read and write permissions.
The rmdir command is used to delete/remove a directory and its subdirectories.
Delete / remove directory.
If the tmp directory is empty, the rmdir command will remove/delete the tmp directory.
Delete the directory tree:
rm -ir tmp
This command recursively deletes the contents of all subdirectories under the tmp directory. You will be prompted for the deletion of each file, and then the tmp directory itself is deleted.
To deletes the contents of all subdirectories under the tmp directory without prompt, you can use the command:
rm -rf tmp
The cd command is used to change directories.
cd /etc/: This command changes from its parent directory to the /etc/ directory.
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”
The pwd command displays the working directory. The pwd command displays the absolute pathname of the current working directory.
The ls command files and directories in the current working directory.
Display the contents of the root directory:
List the contents of the root directory.
Show hidden files and directories:
Lists all items, including hidden files and directories.