Library › Servers & deployment

Free guide

Linux / Terminal for Beginners

The commands you actually need. The terminal lets you control your computer or server by typing commands instead of clicking through a graphical interface.

2 min readFor developers, IT and support staff and students and beginners

The commands you actually need.

The terminal lets you control your computer or server by typing commands instead of clicking through a graphical interface.


1. Where Am I?

pwd

Print Working Directory — shows your current location.


2. What's Here?

ls

More useful:

ls -la

Shows files, hidden files, permissions, ownership, and more.


3. Move Around

Enter a directory:

cd projects

Go up one level:

cd ..

Go to your home directory:

cd ~

Go to a specific location:

cd /var/www

4. Create Things

Create a directory:

mkdir projects

Create an empty file:

touch notes.txt

5. Copy and Move

Copy:

cp file.txt backup.txt

Move or rename:

mv file.txt notes.txt

Move a file into a directory:

mv notes.txt documents/

6. Delete

Delete a file:

rm notes.txt

Delete a directory and its contents:

rm -r projects

⚠️ rm does not normally send things to a recycle bin.

Be careful.


7. Read a File

cat notes.txt

For long files:

less notes.txt

Press q to exit less.


8. Search

Find text inside files:

grep "error" app.log

Search recursively:

grep -r "password" .

Find files:

find . -name "*.log"

9. Run a Command as Administrator

sudo command

Example:

sudo systemctl restart nginx

sudo means run this with elevated privileges.


10. Install Software

On Ubuntu/Debian:

sudo apt update

Then:

sudo apt install nginx

11. Check Running Processes

ps aux

A more convenient view:

top

Press q to exit.


12. Stop a Process

Find the process:

ps aux | grep app

Then:

kill PID

If necessary:

kill -9 PID

Use kill -9 carefully—it forcefully terminates the process.


13. Check Disk Space

df -h

Check the size of a directory:

du -sh folder/

14. Permissions

See permissions:

ls -l

Change permissions:

chmod +x script.sh

Now the script can be executed:

./script.sh

15. Connect to a Server

ssh user@server

Example:

ssh ubuntu@192.168.1.20

Once connected, you're working directly on that machine.


The Commands to Remember

What you wantCommand
Current locationpwd
List filesls -la
Enter directorycd folder
Go upcd ..
Create directorymkdir folder
Create filetouch file
Copycp
Move/renamemv
Deleterm
Readcat / less
Search textgrep
Find filesfind
Administratorsudo
Processesps / top
Disk spacedf -h
Connect remotelyssh

The Beginner Workflow

cd /var/www
ls -la
cd myapp
ls

Read a log:

tail -f app.log

Stop following it with:

Ctrl + C

That's already enough Linux knowledge to start working on a server.


Remember

Terminal = navigating + inspecting + running + managing.

You don't need to memorize hundreds of commands.

Learn the few you use every day.