folder = directory
structure of terminal : ali@godzilla:/Desktop/inoi$
ali is the name of user.
godzilla is the name of computer.
being # means you are administrator(Root User) and $ means you are a normal user. you can Become Root user using sudo -s and exit this mode by exit command.
/ means that we are browsing in root directory
~ means that we are browsing in /home/user_name/ and it always stands for /home/user_name/ .
Note : what # does in terminal ? it works like // in C Plus Plus and if you type it before your command it will skip it and do nothing.
pwd :
how to find the full address of directory we are already in.
ls :
shows all available folders and files in current directory.
cd :
is for changing folder. it has four modes. one is go to parent directory. two is to go to a subdirectory (the folder which is in our directory). three is to go to a given path like /home/mhd/cpp_codes. fourth is just . which just don’t go to any folder and stays in current folder. the fourth may sounds stupid but it has it’s own usages.
go to parent directory : cd ..
go to subdirectory : cd Folder_name
go to given path : cd folder_path
go to current folder : cd .
folder path or file path can be reached with two modes.
think we want to access a file like /home/user/Desktop/inoi/code.cpp
first is Absolut which means we should type full path for example : cd /home/user/Desktop/inoi/code.cpp or cd ~/Desktop/inoi/code.cpp
the second way is Relative and it depends on our current directory for example we are in directory desktop
then we just need to type inoi/code.cpp
tip 1 : if you type cd without dot(s) it will do cd ~.
tip 2 : if you type cd - it will go to previous folder that we were at it.
touch :
makes a file. for example : touch cod.cpp makes an empty cod.cpp file.
if we don’t give a format to out file it will be just a file and you can open it with code editor.
what does touch a b c do? it will make three files named a, b and c.
rm :
rm stands for remove. and it can delete a file or directory. for example : rm code.cpp
rm *.cpp : this will delete all files named anything and their format is cpp. * stands for anything.
the rm can not delete directory by default for example we have a directory sample and we can’t remove it with command : rm sample
so we should use rm -r sample then it will remove folder and all it’s contents. Just take a look at rm syntax with man rm command.
mv :
mv stands for Move. actually it renames a file name. for example we have a file named x.cpp and we want to rename it to y.cpp and syntax is : mv File File_New_Name . for example : mv x.cpp y.cpp