Commands used for File Handling
|
LS The command “ls” displays the list of all directories, folder, and files present in the current directory.
LS - LTR The above-mentioned command displays the name of directories, folders, files with their respective owner name, group’s name, and rights your user has over these.
|
|
|
|
MKDIR The command “mkdir” allows users to create directories/folders in the system. The user running this command must have suitable rights over the parent directory to create a directory or they will receive an error. |
|
|
|
RMDIR The command “rmdir” allows users to remove directories/folders from the system. The user running this command must have suitable rights over the parent directory to remove a directory AND the directory must not have any files or sub-directories within it or you will receive an error. |
|
|
|
RM The command “rm” is used to remove files from a directory.
RM -RF Permanently deletes the specified directory and ALL files and sub-directories beneath the specified directory. Be VERY careful using this command as you can inadvertently delete your whole drive! |
|
|
|
MV The command “mv” is used for two purposes
|
|
|
|
CP The command “cp” is used to copy data from a source file to the destination file. Its function is almost like the command “mv”. The only difference is by using the command “cp” the source file is not removed from the directory after its data is moved to the destination file. |
|
|
|
TOUCH Creates an empty file at the specified path with the specified name. Useful for creating a blank file you intend to edit with a CLI editor, such as VIM or NANO. |
|
|
|
CAT The command “cat” is a reverse of the command “tac”. It is used to display each line of the file starting from the first row and finishing on its last row. This command is more frequently used than “tac”. |
|
|
|
ECHO The command “echo” used to display any expression that is passed as an argument. |
|
|
|
GREP The command “grep” is used to search for a text in the specified file/folder. |
|
|
|
ZIP The command “zip” is used to compress one or more files and store them in a new file with .zip extension. |
|
|
|
UNZIP The command “unzip” is used to decompress a .zip file and extract all the files within to current directory. |
unzip zip_file_name.zip
~/poopoo$ unzip files.zip
Archive: files.zip
replace file1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
extracting: file1.txt
extracting: file2.txt
extracting: file3.txt
SUDO
The command “sudo -I” is used to continue the session as a root user which has a lot more privileges than normal system user.
sudo -i
tim@tim-Nitro-N50-620:~/poopoo$ sudo -i
[sudo] password for tim:
root@tim-Nitro-N50-620:~#