Linux Commands

by Nikolett Muller

commands

Some of us feel stressed when it is about to work with a terminal. However, learning how to use command line is worth every penny. Developers who understand the command line would claim that this is one of the best tools at our disposal. Let's see some important commands!

pwd command

This command stands for print working directory. It shows us which directory we are currently located at.

pwd command
It gives our current directory
ls command

It gives a list of the contents of our current directory.

ls command
The contents of the current directory
cd command

We use it for navigating between directories and folders. We type cd <name of folder> to go into the specific folder. We can check with pwd whether we are in the right folder.

cd command
Navigating among folders

If we want to go back to the previous directory, we type cd .. into terminal.

cd .. command
Going back to the previous directory

If we want to go to the root directory, we use cd /.

cd / command
Going to the root directory
cp command

It stands for copy files. We can make a copy of a file if we type cp <name of file> <new name of file>. As the image below shows, there is a new file in the directory after using cp command.

cp command
Copying file into the same folder

We can copy files and immediately place them into another directory with giving cp <name of file> <path to directory>. Our example shows that the copy is in the other directory.

cp command to another directory
Copying file into another folder
rm command

It is used for removing or deleting files. As the example below shows, by using rm command Slack_introduction2.png has been deleted from the directory.

rm command
Deleting a file

We can also delete a non-empty folder by using rm -r <name of folder> command.

rm command for non-empty folders
Deleting folders with content
touch command

We can create files by using touch command. To do this, we need to type touch <name of new file>.

touch command
Creating a file
mv command

We can move our files to other directories by typing mv <name of file> <path to directory>.

mv command
Moving a file to another directory
mkdir command

We use this command to create new folders. When we type mkdir <name of new folder>, it creates an empty folder in the current directory.

mkdir command
Creating a new empty folder
rmdir command

This command deletes only empty folders. As we can see, our example shows that TestFolder is not located in WebSystem anymore; it has been deleted.

rmdir command
Deleting an empty folder
clear command

It clears the screen of the terminal.

man command

It stands for manuals. If we want to know more about a command, we can use this command to help us. We type man <name of command>, and the terminal will give us a detailed description about the searched command.