Here we give a list of Basic command that can be used on Ubuntu(or linux) OS. All these command will work in “Terminal”.
Use this command to get help pages for any command.
Use “q” to quit the help page (or the man command).
If you want to get options that can be used with a command, man is the command that will help you on that.
Use this command to know the present working directory. If you open “Accessories->Terminal”, the terminal opens in
The above command for a user named “jaggib” will give:
A directory path can be:
The path with reference to root directory is called absolute.
This is the path of user directory from root directory.
The path with reference to current directory is called relative.
You can also target the sibling directories of the current directory.
Same can be approached to target even higher parent folders.
home directories is available.
Use this command to get a list of files and directories that are in the present working directory.
Now you can change the way the data will be displayed, using the options:
You can also use “ls” to get a view of file attributes for each file or directory by using:
You can use “ls” to view hidden (or system) directories and files also using:
Use this command to create a file in the present working directory. It can also be used to Update the access and modification time on a file.
The following example will create a new file
command to make a directory in the present working directory (i.e. current directory).
The following example would create a new directory
Use this command to change the directory i.e. to change from current working directory to some other directory.
where, directory path can be
Use this command to copy a file(s) or directory(s).
cp <file-to-be-copied> <copied-file-name>
Use this command to remove a file(s) or directory(s).
To remove a file forcefully (without prompt) when in
rm -f <file-name>
To remove a directory:
rm -r <directory-name>
To remove directory and its subdirectories and files recursively:
rm -rf <directory-name>
Use this command to move files from one directory to other (also used for renaming).
mv <source-name> <destination-name>
If destination specified doesnt exist, it will create a new file. So, it functions as
cp command in that case.
If destination is a directory name, the source is a file then it will be copied into the directory name specified.
mv file.txt \Documents
If both are files, the source file would be removed and destination file would be created with the same content as source file. Also, note that if there exist a file already with the specified destination file name, it will be replaced too.
If the source folder is a directory with subdirectories and files, you can copy whole content recursively using
mv -R /source_dir /destination_dir
Use this command to run a command as administrator (or the user having privileges to execute that command).
Lets say you want to open file manager as root, you can do it using sudo: