#Course

Linux

Linux is an open-source operating system based on Unix, created by Linus Torvalds in 1991.

GIIA··8 min read
Linux

Before Starting

Linux is an open-source operating system based on Unix, created by Linus Torvalds in 1991. It consists of a kernel and multiple distributions (like Ubuntu, Fedora or Debian). It is used in servers, supercomputers, Android and even IoT devices. Its main advantage is the stability, security and customization it offers compared to other systems.

In other operating systems (like Windows or macOS) many things are limited or automated, while in Linux you have full control.

  • If something fails, you can fix it yourself without depending on updates or licenses.

  • If you work with servers, networks or development, almost everything works better and more stable on Linux.

  • If you program or manage systems, understanding Linux prepares you for any professional environment, since most of the world's servers use it.

Before using commands, there are several basic things that make Linux make sense:

  • Everything in Linux is a file, even devices (/dev/sda), configurations (/etc) and virtual processes (/proc).

  • The file system is hierarchical, starting from / (the root) and from there it goes down: /home, /etc, /usr, /var, etc.

  • Permissions work with numbers:

    • r = 4, w = 2, x = 1.

      Example: 7 = 4+2+1 → read (4), write (2) and execute (1). That's why 754 means:

      • 7 → owner: rwx

      • 5 → group: r-x

      • 4 → others: r--

  • sudo means "do it as administrator". It's used to execute actions that affect the system (install, delete, modify configurations).

  • apt is the package manager for Debian/Ubuntu, it allows you to install, update or remove programs.

  • nano is a simple text editor, useful for editing configurations without relying on a graphical environment.

  • The terminal is an interface to control the system with commands and many of them are designed to be chained together using pipes (|), redirections (>, >>).

  • Users and groups determine who can do what, and that's why chmod, chown, etc. are important.

Getting Started

Small practical reference to move and work in the terminal without getting tangled. Ideal if you access via SSH or are starting in Linux.

Basic navigation

To move through the file system you need to locate yourself, list and change directories.

CommandDescription
pwdShows the current path (which folder you are in)
lsLists the files and folders of the current directory
ls -lLists with details (permissions, size, date, etc.)
ls -aAlso shows hidden files
cd folderChanges folder
cd ..Goes up one level
cd ~Goes to the user's directory (home)
clearClears the screen

Handling files and folders

Editing, creating, moving and deleting files is basic for any terminal administration.

CommandDescription
touch file.txtCreates an empty file
mkdir new_folderCreates a folder
cp source destinationCopies files or folders
mv source destinationMoves or renames files
rm file.txtDeletes a file
rm -r folderDeletes a folder and its content
cat file.txtShows the file content
nano file.txtEdits a file in terminal (simple editor)
head file.txtShows the first lines
tail file.txtShows the last lines

Useful tip: tail -f file.log shows the content of a log live.

Permissions and owners

Linux controls access through users, groups and permissions. Remember: r=4, w=2, x=1.

CommandDescription
chmod 755 fileChanges permissions (read, write, execute)
chmod +x script.shGives execution permission to the file.
chown user:group fileChanges the owner
ls -lAllows seeing the current permissions

Structure of a permission: drwxr-xr-- → type + owner + group + others.

System information

It allows you to see how the system is, the resources and what is running.

CommandDescription
whoamiShows your username
hostnameShows the machine name
uname -aShows system information
topShows active processes and CPU/RAM usage
df -hShows available disk space
free -hShows used and free RAM

Also useful:

  • htop (if you install it), to see processes more nicely.

Packages and updates (Ubuntu/Debian)

apt manages system packages (programs, libraries, tools).

CommandDescription
sudo apt updateUpdates the list of available packages
sudo apt upgradeInstalls available updates
sudo apt install packageInstalls a package
sudo apt remove packageUninstalls a package
apt search nameSearches for a package

Other useful commands

CommandDescription
historyShows the last used commands
echo "text"Shows text on screen
man commandOpens the command manual
exitCloses the current session
shutdown nowTurns off the system
rebootRestarts the system

Tips

  • Use the Tab key to autocomplete commands or paths.

  • Use the ↑ and ↓ arrows to repeat previous commands.

  • Always be careful with sudo and with rm -r.

  • If a command doesn't work, try preceding it with sudo.

  • man command always explains better than the internet.

  • Think before using sudo Don't execute things "just because". If you don't know what a command does, check man or search first.

  • Avoid using rm -r in incomplete paths One misplaced space and you could delete half the system. Tip: before executing, use ls folder_you_are_going_to_delete to confirm.

  • Don't work as root unless necessary A small error as root can break the entire system.

  • Use absolute paths when doing delicate tasks Avoid depending on "where you are standing".

  • Document changes you make to /etc Even if it's just with a comment at the beginning of the file or a .backup file.

  • Don't install packages recklessly Keep the system clean. Unnecessary packages = more things that can break.

  • Update, but not compulsively apt update && apt upgrade is fine… but don't do it 100 times a day or on critical systems without checking what gets updated.

  • Use grep, tail, journalctl and logs to diagnose Guessing wastes time. Logs almost always have the answer.

  • Make simple, modular and commented scripts You'll thank yourself later.

  • Use minimum necessary permissions Don't give everything 777 "to make it work". Many times the problem is not about permissions, but about paths or users.

  • Learn to use tab and history It speeds up your work and prevents you from making mistakes typing long paths.

  • Keep your structure organized Folders with clear names, files in consistent places, and no trash left around.

  • Make backups before editing important files Example: cp /etc/file.conf /etc/file.conf.bak

  • Don't accept commands from someone without reading them Especially if they include pipes with sh, curl, wget, or strange things.

  • Using sudo without understanding what the command does It's the fastest way to break your system. sudo rm -r / is a classic joke… but it happens more often than you think.

  • Working as root all the time If you're root, any error is fatal: you can delete, overwrite or break services without the system warning you.

  • Giving permissions 777 "to make it work" This leaves the file or folder completely exposed. If something requires 777, the problem is elsewhere.

  • Editing configuration files without backup If you mess up, you won't have a way to go back.

  • Ignoring logs Many novices try to guess why something is failing. Logs almost always tell you exactly what happened.

  • Copying commands from the internet without reading them Worse if they come with pipes to sh, downloaded scripts or strange paths.

  • Using relative paths for dangerous operations If you're in the wrong folder… goodbye files.

  • Filling the system with unnecessary packages More packages → more updates → more dependencies → more problems.

  • Forgetting to close processes or SSH sessions Creates conflicts, zombie processes, and sometimes even lockups.

  • Installing random versions from the internet Especially suspicious .sh files or packages that aren't from the official repository.

  • Working without checking what services are running Modifying configurations while a service is running can cause errors that are later difficult to trace.

  • Not knowing the actual user that runs something Many services run under users like www-data, postgres, etc. And if you change permissions without understanding that, you break apps by mistake.

  • Deleting folders or files generated by the system "because you don't understand them" Especially in /var, /usr, /etc and /lib.

Extras

Extra links and official documentation for linux and many related services.

Kernel and system

Distributions

Package managers

Manuals and general documentation

Administration and servers

Authors

GIIA
GIIA

GIIA