Linux is a popular open-source
Because it requires technical knowledge and built-in commands to operate properly, it is mostly used by programmers.
Some of the basic file directory commands used in Linux distributions are demonstrated in the figure below:
pwd
: present working directoryThis command shows the current directory the user is working on. In the example below the pwd
commands would help show the current directory the user is at, which is the root directory ~
.
Alvan@Alvan:~$ pwd
mkdir
: make directoryThis is used to create a new directory for a user. In the example below, the mkdir
command helps create a new directory with DIN
on the current working directory.
Alvan@Alvan:~/Desktop$ mkdir DIN
cp
: copy commandWe use this command to copy files, directories, or groups of files from a source address to a destination address.
In the example below, we have used the cp
command to copy the latest.txt
file from the Desktop
directory to the Data
directory.
Alvan@Alvan:~/Desktop$ cp latest.txt Data/
rm
: to removeWe use this command to remove files and directories. The rm
command is used to remove the latest.txt
file in the Desktop
directory.
The rm * latest.txt
would remove every other file with the latest.txt file.
Alvan@Alvan:~/Desktop$ rm latest.txt
touch
This command is used to create or update a file. In the example below, the touch command creates a new file, latest.txt
.
Alvan@Alvan:~/Desktop$ touch latest.txt
ls
: listThis command would display the files contained in the directory you are currently at.
In the example below, the ls
command gives a list of files in the Desktop
directory.
Alvan@Alvan:~/Desktop$ ls
cd
: change directoryThis is used to move from one directory to another. In the example below, the cd
command moves from the ~
: root directory to the Downloads
directory.
Alvan@Alvan:~$ cd Downloads
cd..
: previous directoryThis command takes the user to the previous directory. In the example below, the cd..
command takes the user from the Downloads
directory to the ~
: root directory.
Alvan@Alvan:~/Downloads$ cd..