Basic Commands
pwd - used to determine which directory you are in.
cd - to go to the home directory.
cd + (directory) - name of a directory connected to the current directory. (relative path).
/ - the root of the file system. (absolute path).
Navigation and File Management
ls - to look at the contents of directories.
ls -l - a much detailed one.
ls -a - to see the hidden contents at the directory.
cd + (directory_name) - changing directory.
File and Directory Manipulation
touch - used to create a file.
mkdir - used to create a directory (folder).
touch filename1 filename2 - to create multiple files.
mkdir foldername1 foldername2 - to create multiple directory.
mkdir -p - used to create directory inside the directory and create directory again inside the created directory.
Copying Files and Directories with "cp"
cp - used to copy and paste file.
ex. (cp filename Newcopyfile - copying file and pasting the file to the same directory.)
cp -r - used to copy Directory and paste the copied directory inside the other Directory.
ex. cp -r folder2 folder1 - it will create a folder2 inside the folder1.
Removing Files and Directories with "rm" and "rmdir"
rm - used in removing files
rmdir - used in removing empty directories
rm -r - used to remove directory and everything inside the directory.
rm --r - used to remove multiple directory.
Editing Files
nano - used to create a file or edit a file.
nano + (existing_filename) - to edit existing file.
nano + (newfile) - to create a new file and to edit inside.
cat - to display the content of the file in the terminal.
less - to open the file for viewing.
Moving and Renaming Files and Directories with "mv"
mv filenameOld filenameNew - renaming file.
mv filename directoryName - moving file to directory.
mv filename1 filename2 filename3 DirectoryName - moving multiple file to directory.
mv DirName NewDirname - renaming Directory. Note that the new name you want to use is not existing or else it will go inside the directory name(given name).
mv -n - to prevent overwriting on existing file.
mv -i - asking first if you want to overwrtite existing file. (y) if yes and (n) for no.
In conclusion, I have learn how to see the files and directories available. I also know file manipulation commands that will allow me to view, copy, delete, or move files and directories. And also tried editing inside a file using nano text editor.
Top comments (0)