This is not intended to be a guide, but rather a list of useful commands that you can run on your Raspberry Pi from the terminal.
Useful Linux commands are practically as limitless as the possibilities of the Raspberry Pi, but I have chosen to collect here the ones I have found most useful over the years.
First of all, to make things easier: if the command described is not available in your distribution, simply install it by running the following in the terminal
sudo apt install -y [command]
and if you can’t find it
apt list [command]*
or
apt search [command]*
and if you run into insufficient permission problems, simply prefix the command with
sudo su
Let’s start with the basics
man [command name] : opens the command’s manual with all the useful informationls : lists files and folderscd [path] : changes directorymkdir [folder name] : creates a foldertouch [file name] : creates an empty filerm : deletes files or empty directoriescp [path 1] [path 2] : copies files or foldersmv [path 1] [path 2] : moves files or folders, or renames filesnano [file name] : edits text filescat [file name] : reads text files. Add| egrep -v "^\s*(#|$)" to hide all commented-out lineshead [file name] : reads the first lines of a text or outputtail [file name] : reads the last lines of a file; essential for logsgrep : essential for searching for text in a file or outputapt : installs, searches for and removes applications, and updates the operating systemps -aux | grep [program name]: displays and searches for the name of a running processtop or htop : display resource usage by processkillall [process name] : kills all running tasks with that namekill [pid] : kills a single specific process by its PIDchown [user:group] [file or folder] : changes the owner of files and folderschmod +x [file] : makes a script executablechmod : changes the permissions of files and foldersssh user@computer : connects via SSH to a computer running an SSH serverufw limit [port] : opens a port on the software firewall, rate-limiting it in case of attacksssh-copy-id user@computer : adds your personal key to the remote host, so you can log in without a passwordrsync : copies files and folders; useful for backups, and combined with ssh-copy-id it makes remote backups easyhostname -I : displays all of the Raspberry Pi’s IP addresseslsusb : displays all USB devices; useful for checking Wi-Fi donglesiwconfig and ifconfig : check the status of network adapterstar -zxvf [file.tar.gz] : extracts archivesdu and df : display used disk spaceping [ip or host] : sends packets to see whether a host respondsnmap : scans the networkcurl and wget : send and download datactrl + l : clears the terminalpage down: types the tilde ~ctrl + r : searches the history of previously run commandspip and pip3 : manage Python 2 and Python 3 modules respectivelyopenssl rand -base64 10 : generates a random valuecertbot : enables certificates for local websites
Enjoy!
