- Mastering basic Linux syntax and essential commands speeds up any task on desktop and server systems.
- Combining navigation, file management, text, and processes allows you to automate complex workflows from the terminal.
- Keyboard shortcuts, history, and aliases reduce errors and typing time when working in the console daily.
- Controlling permissions, processes, and network with tools like chmod, ps, kill, ping, or htop gives you total control of the system.
If you use computers daily, sooner or later you'll come across Linux. Although it's barely around... small fee on desktopThe overwhelming majority of servers, clouds, and web services run on this system. That means that, whether you like it or not, knowing the Linux tricks and commands It makes a difference when you're managing a VPS, a production server, or even just a Linux distribution on your laptop. It's also helpful to consult web resources for linux when you are learning.
Furthermore, Linux is the preferred platform for many professional developers, system administrators, and advanced users. This is no coincidence: it is Free, stable, secure and very powerful software on the command line. With a few well-learned commands, keyboard shortcuts, and little tricks, you can perform tasks in seconds that would take many minutes and several clicks in a graphical interface. Understanding the command line interface It helps you get the most out of it.
What is a Linux command and how is it structured?
A Linux command is nothing more than a program or utility that runs from the terminalThe terminal or console is a text interface where you write instructions that the system interprets and executes immediately, without intermediate layers or windows.
Most of the actions you perform in a graphical interface are, behind the scenes, command callsWhen you close a window, copy a file, or install a program from a graphical manager, equivalent commands are actually being executed in the background.
The typical syntax of a command in Linux has three main components: command name, options, and parametersYou could see it as a very compact sentence where the verb is the command and the rest clarifies what you want to do.
The options (or flags) They modify the behavior of the command. They are normally written with a hyphen (-l) or double (--longThere are flags that activate specific modes, change the output format, or request interactive confirmation.
Los parameters or arguments These are the inputs the command needs: file paths, usernames, search patterns, IP addresses, etc. In many cases, the order of these arguments matters, so it's a good idea to look at the exact syntax shown in the man pages.
Prerequisites and access to the terminal
To apply all these tricks you need to have a functional command lineOn a Linux desktop, you can open it with combinations like Ctrl + Alt + T or by searching for "Terminal" in the applications menu.
If you work with a remote server, you will normally connect via SSH from another computerusing clients like PuTTY on Windows or the terminal itself on Linux and macOS. Access usually takes this form: ssh usuario@ip_del_servidorIf you don't have Linux installed locally, another option is to use Linux in virtual machine to practice.
Those starting out with Linux on a VPS server can rely on control panels that offer a integrated web terminalSo, there's no need to install anything on your local machine. Some providers add AI-powered assistants that suggest commands based on what you want to do—a helpful tool if you're not yet fully comfortable with the syntax. If you prefer to practice in the cloud, there are options like online Linux terminal.
Before diving into more advanced operations, it's key to feel comfortable navigating the file system. The terminal offers simple commands to guide you and switch folders quickly.
The command pwd (print working directory) shows you the absolute path of the current directory, for example /home/usuario/DocumentosIt's your compass when you can't remember where you are.
To list the contents of a folder you use ls, shows files and subdirectoriesYou can add options such as -a to see hidden elements or -lh to view them in readable sizes such as MB or GB.
Changing directories is done with cdYou can move using absolute or relative routes, and take advantage of shortcuts like cd .. to level up, cd - to return to the previous directory or simply cd / cd ~ to return to your personal folder.
When you frequently switch between the same locations, it's very useful to understand that the shell maintains a previous route historyCombined with commands like pushd y popdYou can manage a "stack" of directories and jump between them quickly, although that's a slightly more advanced trick.
Managing directories and files from the console
Linux is designed so that you can create, copy, move and delete files You can do this incredibly quickly from the terminal, without needing to open a graphical browser. The key is mastering a few commands.
To create new folders you use mkdirYou can specify a single route or several, and rely on options such as -p to generate complete trees (for example, mkdir -p Musica/2025/Album It will create all intermediate folders if they do not exist.
If you make a mistake or no longer need an empty directory, the command rmdir allow always remove it as long as it contains nothing insideIf it has subfolders or files, you will have to resort to rm -r or reorganize its content beforehand, or learn to Renaming a folder in Linux when what you're looking for is to change the name.
File deletion is done with rmwhich is powerful but dangerous. You can delete one or more items at once, combining options such as -i to demand confirmation, -f to force without asking and -r to delete directories recursively.
Copying elements is achieved with cpWith a simple combination you can duplicate one or more files in another directory, clone a file with a different name or copy an entire tree by adding -R so that it is recursive.
If you want to move or rename files, you will use mvWhen the destination is another folder, the file changes locationIf the destination is a name within the same directory, you simply rename it without moving it. For more details on how Renaming files in Linux You have specific guides.
The command touch It serves both for create empty files such as updating access and modification timestamps. It's very practical for quickly generating test files or scripts that you can then edit.
Finally, if you want to know what type a file is (text, image, binary, etc.), the command file analyzes its content and describe its naturewhich helps you decide which tool to use to open it or how to process it.
Search and locate files
As a system grows, manually finding what you're looking for becomes impractical. Linux offers several utilities for this. track files by name, pattern, or location very precisely.
The command find It traverses directory hierarchies and allows filtering by name, type, size, modification date, and many other criteria. For example, you can locate all Python scripts in your current folder with something like find ./ -type f -name "*.py".
By using find You can specify the base path to start searching, various filtering options, and a final expression that defines what you want to find. This is common practice. combine it with actions to execute a command on each match..
Another similar tool, but based on a indexed database of the systemit's locateAfter updating the index, it allows you to almost instantly search for routes containing certain words, with options such as -i to ignore uppercase letters or patterns with asterisks for more flexible searches.
Compression, files, and data transfer
In server and development environments, it is very common to package multiple elements. compress them and move them between machines. Linux integrates classic tools for this entire workflow, usable directly from the terminal.
To group directories and files into a single container, you would typically use tarYou can create an archive, compress it instantly, extract it, or list its contents, all with specific options. Normally, it's combine flags to create compressed files, for example tar -cvzf backup.tar.gz carpeta/.
When you want to work with the ZIP format, widely used outside the Unix world, the commands zip y unzip permiten Generate and extract ZIP files It's simple. You can adjust the compression level, choose what to include, or where to decompress the content.
If you need to bring resources from the Internet in a non-interactive way, wget y curl They are your allies. With wget download files or entire sites using HTTP, HTTPS or FTPIdeal for automating downloads from scripts. With curlIn addition to downloading data, you can interact with APIs, change HTTP methods, send custom headers, or upload files. Furthermore, certain network configurations may require... edit the hosts file.
To securely copy content between machines, you use scpwhich combines the strength of the SSH protocol with the convenience of a simple command. You can send or receive files and directories indicating the origin and destination route in the format usuario@servidor:/rutaand adjust details such as port or compression with its options.
When you want to optimize compression with alternatives to gzip, it's helpful to know specific utilities: if you work with bzip2, for example, learning how to mastering bzip on Linux It will help you adjust efficiency and speed.
Displaying, filtering, and editing text in the console
In Linux, practically everything is represented as text: configurations, logs, scripts, command output… That's why it's important to be proficient with the tools for view, search and transform text It's one of the most powerful tricks you can learn.
To quickly view the contents of a file, you use catwhich prints everything to standard output. It's very useful for check small files on the fly or concatenate several into one, redirecting the output to another file.
When the file is large, it is more convenient to lean on lessIt allows you to scroll up and down, search for patterns, and exit without making any changes. It's a very practical mix between a paginated viewer and a lightweight editor, perfect for inspect extensive logs.
If you are only interested in the beginning or the end of a file, respectively head y tail They print the first or last lines. With options like -n You can adjust how many lines See, which is great for taking a look at the header of a CSV or monitoring the latest records being added.
To locate lines that contain a specific pattern, the key is grepWith it you can search for words, regular expressions, or parts of text in one or more files, count how many times they appear, filter by uppercase/lowercase and much more.
When you need to edit text without opening a graphic editor, sed It comes into play. It's a flow editor that allows replace, delete or extract lines based on patterns, and is extremely useful for automating corrections in configuration files or large volumes of data.
For more complex extraction and processing tasks, awk It works like a small, text-oriented programming language. It lets you work by columns, apply mathematical operations, execute conditions and generate reports from structured files.
Commands like sort, uniq, comm or utility column They help to sort, remove duplicates, compare files line by line, and to present data in a more readable way, especially when they work together linked by pipes (|).
Permissions, users, and basic security
One of the pillars of Linux is its permissions model. Each file has an associated permission. owner, a group, and a set of permissions that control who can read, modify, or execute it.
The command chmod It's used to change those permissions. You can do it with symbolic notation (r, w, x for read, write, and execute) or with numeric values like 755 or 644 depending on what you want to grantA typical use is to make a script executable with chmod +x script.sh.
If you need to modify the ownership of a file or folder, chown allows you to assign it to another user and/or groupThis is especially important when managing services that need to run on specific accounts with limited permissions.
When administrative actions need to be performed, such as installing packages or modifying system files, this comes into play sudoThis command executes the following command with superuser privileges, after authentication with your password, and is the recommended way to avoid working permanently as root.
The command passwdFor its part, it allows you change your account password (or others if you have the appropriate permissions). It first asks for the current password and then the new one, and it's best to use it carefully to avoid blocking access for critical users. For network access control and firewalls, it's also useful to know iptables in Linux.
Process management, resources, and system shutdown
Another essential block of Linux tricks has to do with monitor what is being executed, how much each process consumes and how to control the system in general, especially on servers that do not have a graphical environment.
The command ps It offers a snapshot of the active processes associated with your session or the entire system, depending on the options. You'll see the identifier (PID), the associated terminal, the CPU time consumed, and the command that launched each process, making it easy to... locate uploaded programs.
For a more convenient real-time view, top and especially htop They show processes, CPU usage, memory, average load, and other indicators. The interactive version lets you sort by consumption, filter and kill processes directly from the text interface.
The moment an application stops responding and you can't close it through normal means, kill It allows you to send it signals to terminate. The most common is to use the default signal (similar to a "clean close") or, if that doesn't work, a stronger one. force the immediate end of the process, with the risk of losing unsaved changes.
To find out how much disk space you are using, df shows the usage of each file system, while du It serves for measure the size of directories and subdirectories specific details, with options to view it in KB, MB or GB.
You can obtain more general information about the system with uname, which reveals kernel details, architecture, and hostname. Utilities such as neofetch They present this same information in a more visually appealing way alongside your distribution's ASCII logo.
When it's time to shut down or restart a computer from the console, the command shutdown leaves you Schedule the shutdown instantly or at a specific time.as well as canceling a pending shutdown with specific options. In production environments, it is important to notify and coordinate these actions effectively.
Network, connectivity and transfers
On servers and workstations that are always connected, network management is part of daily operations. The command line offers simple tools to check connectivity and move data across the network.
The classic ping It sends packets to a domain or IP address and displays response times and packet loss, something basic for detect connection problems or unusual latencies. Combine this knowledge with guides on how ping in Linux to diagnose network problems.
we have already mentioned wget y curl for downloads and HTTP requests, but you can also use scp to transfer files and entire directories between machines by encrypting the communication. Together, these commands form a very complete networking kit without the need for graphic design clients.
When you want to periodically run certain checks or collect network metrics, the command watch This is very useful: it executes another command at regular intervals of time and it shows the differences from one execution to another, which simplifies monitoring changes.
Command history, aliases, and reuse
One of the best things about the terminal is that You don't have to write everything from scratch Again and again. The system and the shell provide you with a good number of shortcuts to repeat commands, correct them, and reduce errors.
The command history It displays a numbered list of all recently executed commands. You can use it to search for old commands and launch them again without typing them again, combining them with the exclamation mark (!n) to repeat entry number n.
It is also possible to reuse the last command with !!A quick way to repeat what you just did. A typical use is when you forget to put sudoIf you execute a command that fails due to permissions, simply retry with sudo !! to launch it as administrator without rewriting it entirely.
There are even lesser-known shortcuts, such as !-2 to execute the penultimate command, !string to repeat the last one that began with a certain word, or substitutions of the type ^texto_viejo^texto_nuevo to replace part of the previous order on the fly and run it again.
Aliases are another fantastic tool: with the command alias You can define abbreviations for long commands, or adjust the default behavior of some commands. For example, define alias ll="ls -lh" to have a detailed list o alias rm="rm -i" to force it to always ask for confirmation.
All of this is complemented by each user's own history file, normally ~/.bash_history or equivalent, where orders from previous sessions are stored. By configuring how that history is saved and cleared, you can fine-tune how many commands are remembered and for how long.
Keyboard shortcuts and quick editing in the terminal
Speed on the command line doesn't just come from knowing a lot of commands, but also from move and edit text at full speed without taking your hands off the keyboard. Most terminal emulators inherit Emacs' shortcuts, although many allow you to change them.
To navigate a long line, shortcuts like Ctrl + a y Ctrl + e They take you to beginning and end of the line respectively. You can also move forward or backward word by word with combinations like Alt + f y Alt + bmuch faster than walking with the left and right arrow keys.
If you make a mistake while typing, Ctrl + u deletes everything from the cursor to the beginning of the line and Ctrl + k Delete from the cursor to the end. These are perfect shortcuts for clean or trim long orders without deleting character by character.
To manage what is seen on screen, clear and its keyboard equivalent Ctrl + l They clear the current view by pushing the content upwards. If what you want is completely reset the session from the emulator, the command reset It even erases the previous scrollback, as if you closed and reopened the window.
Cursors ↑ y ↓ They let you browse through the history of previous orders.and combinations such as Ctrl + Shift + PageUp o Ctrl + Shift + PageDown They are useful for navigating through the printed content, especially when the outing has been very long.
Other details that greatly improve comfort include the possibility of temporarily block and unlock the terminal Ctrl + s y Ctrl + qor quickly change the font size with shortcuts like Ctrl + Shift + + y Ctrl + Shift + - to adjust readability.
Working with tabs and accessibility of the terminal emulator
When you spend many hours on a console, it's very practical to organize yourself in multiple tabs or windowsespecially if you're monitoring services while editing files or running long scripts.
In most emulators, combinations like Ctrl + Shift + T open a new tab, and then you can move between them using different shortcuts depending on the specific program (for example, with Ctrl + PageUp/PageDown or variants with Shift).
Closing a tab is usually as simple as typing exit or use shortcuts like Ctrl + d o Ctrl + Shift + wwhich ends the shell session for that tab. This is the same as closing the window, but it allows you to keep other sessions open simultaneously.
If you need to concentrate on a task, many emulators allow you to put the terminal in Full screen with keys like F11Hiding bars and decorations to make the most of the space. Setting up a legible color scheme and a comfortable font also improves the experience and accessibility.
Finally, commands like column They help to present more readable output by distributing the information across well-aligned columns. This, combined with a good color scheme, makes it read the output of complex commands be less tiring and clearer, especially when you work many consecutive hours at the terminal.
With all these Linux tricks at your fingertips—from basic commands for navigating and managing files to text tools, networking, processes, and keyboard shortcuts—you'll have a A tremendously flexible, fast-paced work environment that adapts to your work style.Whether you manage servers daily or have just started tinkering with your first distro.
Table of Contents
- What is a Linux command and how is it structured?
- Prerequisites and access to the terminal
- Basic directory and environment navigation
- Managing directories and files from the console
- Search and locate files
- Compression, files, and data transfer
- Displaying, filtering, and editing text in the console
- Permissions, users, and basic security
- Process management, resources, and system shutdown
- Network, connectivity and transfers
- Command history, aliases, and reuse
- Keyboard shortcuts and quick editing in the terminal
- Working with tabs and accessibility of the terminal emulator
