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 directory
This 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
mkdir: make directory
This 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 command
We 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
Alvan@Alvan:~/Desktop$ cp latest.txt Data/
rm: to remove
We use this command to remove files and directories. The
rm command is used to remove the
latest.txt file in the
rm * latest.txt would remove every other file with the latest.txt file.
Alvan@Alvan:~/Desktop$ rm latest.txt
This command is used to create or update a file. In the example below, the touch command creates a new file,
Alvan@Alvan:~/Desktop$ touch latest.txt
This 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
cd: change directory
This is used to move from one directory to another. In the example below, the
cd command moves from the
~: root directory to the
Alvan@Alvan:~$ cd Downloads
cd..: previous directory
This 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.
View all Courses