Linux

The basic Linux commands

A beginner reference for basic Linux commands: pwd, ls, mkdir, mv, cd, nano, cat, history, installing Apache, adding a user, and connecting over SSH.

· 1 min read · level: beginner

Let us break the ice and get started with Linux systems.

You will find the equivalent of what is presented here in the great video by cocadmin.

Command summary

pwd = Print Working Directory / Show the current directory

ls = List / List the content of the directory

mkdir nom_du_dossier = Make Directory / Create a directory

mv chemin_du_dossier nouveau_chemin_du_dossier = move or rename

cd chemin_du_dossier = Change Directory / Change directory

nano hello.txt = edit the file hello.fr

In nano you can save with CTRL+O

then Enter to confirm

and quit with CTRL+X

cat hello.txt = Show the content of the file

cd /home/mdc = Return to the home directory of user mdc

cd = Home of the personal directory

history = View the command history

sudo apt install apache2 = install the web service

cd /var/www/html = move to the web directory

sudo mkdir site-monprénom = Create a directory

cd /var/www/html/site-monprénom = Move into the directory

sudo nano mapage.html = create a mapage.html file

<!DOCTYPE html>

<html>

<head>

<title>My simple HTML page</title>

</head>

<body>

<h1>Welcome to my simple HTML page</h1>

<p>This is an example paragraph.</p>

</body>

</html>

adduser nom_utilisateur = Adding a new user

sudo usermod -aG sudo nom_utilisateur = Adding sudo rights to the user

To test the new user

exit = Quit the session

ssh nom_utilisateur@IP_serveur = Connect to the server with the new user

sudo passwd nom_utilisateur = Change a user's password