Essential commands for working with the Linux command line.
A text-based interface to interact with the shell.
A program that interprets and runs user commands in the terminal.
echo $SHELL
bashHow to install key tools for Linux terminal work.
sudo apt install vim neovim emacs tree jq graphviz htop sed gzip python3Useful daily commands for keeping your Linux system up-to-date and clean.
sudo apt update && sudo apt upgradesudo apt update— Updates the list of available packages.
Обновляет список доступных пакетов.sudo apt upgrade— Installs the latest versions of installed packages.
Устанавливает последние версии установленных программ.
sudo apt remove package-name- Removes the specified package from the system.
Удаляет указанный пакет из системы.
sudo apt autoremove- Removes unused dependencies and old package remnants.
Удаляет неиспользуемые зависимости и остатки от старых пакетов.
📌 It is recommended to run these commands regularly (e.g., daily or weekly) to keep your system clean and secure.
Everything in Linux is a file or directory.
pwd # Print current working directory
ls # List directory contents (short format)
ls -l # Long format: permissions, owner, group, size, date, filename
ls -lrt # Long format + sorted by time (most recent last)
tree -L 2 # Show directory structure as a tree, limited to 2 levels-l— long format with detailed file info (permissions, size, date).-r— reverse order (e.g. oldest files first).-t— sort by modification time, newest first.- Other useful options:
-a— show all files, including hidden (.prefix)-h— human-readable sizes (ls -lh)
Rules that define who can read, write, or execute a file.
ls -l
chmod 755 folderr— read permissionw— write permissionx— execute permissiond— directory (if the first character inls -l—d)
Example: drwxr-xr-x
d— directoryrwx— owner: read, write, executer-x— group: read, executer-x— others: read, execute
The most powerful user with full access to the system.
sudo apt updateManaging users and assigning them to groups for permissions.
groups # Show groups for current user
groups username # Show groups for another user
sudo usermod -aG sudo username # Add user to sudo group
sudo gpasswd -d username sudo # Remove user from sudo group
getent group sudo # List all members of sudo groupShortcuts to navigate and control the terminal efficiently.
history
history | less
Ctrl+D # exit shell or PythonSearch for specific commands you've used in your history.
history | grep vim
history | grep sudo
history | grep installInstall:
sudo apt install emacsInstall:
sudo apt install neovimInstall:
sudo apt install vimTerminal-based text editors used to write and edit code or configuration files.
vim file.txt
nvim file.txt
emacs file.txti # insert mode
Esc # back to command mode
:wq # save and quit
:q! # quit without savingInstall:
sudo apt install sedA stream editor used to find and replace text in files.
sed 's/old/new/' file.txt
sed -i 's/old/new/g' file.txtInstall:
sudo apt install jqA command-line tool for processing and formatting JSON data.
jq '.key' file.json
jq 'keys' file.json
jq '.users[].name' file.jsonInstall:
sudo apt install treeDisplays the directory structure in a tree format.
tree -L 2-L— limit display depth to N levels (e.g., 2)-a— show all files (including hidden)-d— only show directories
Tools for compressing and decompressing files.
gzip file.txt
gunzip file.txt.gz
tar -czvf archive.tar.gz folder/
tar -xzvf archive.tar.gzInstall:
sudo apt install graphvizA tool for visualizing graphs described in DOT language.
digraph authn {
A -> B
B -> C
}dot -Tpng file.dot -o output.pngA popular and easy-to-learn programming language.
python3
print("Hello")
Ctrl+D # exitInstall:
nmcli is included in the network-manager package (default on Debian)A command-line tool to manage network connections.
nmcli connection show