Linux Commands – top ten or thereabouts

Linux Commands – top ten or thereabouts

Commands I’m forever Googling…

CommandDoes what?Example
historyPrints previously executed commandshistory
Re-executes a previous command:
!! – last command (inc sudo !!)
!n – command at history line n
!-n – n commands ago
sudo !!
pwdPrint Working Directorypwd
rmdirRemove empty Directoryrmdir
rmRemove any Directorrm
locatefind filelocate -l hello*
dfdisk spacedf -m
dudisk usagedu Documents
ls -lah
ls -alSr
LiSt directory with file sizes
in size order (S), in reverse (r)
ls -lah
ls -alSr
psProcess Statusps aux (note “aux” are a, u & x options)
servicelist enabled services
detail specific service
service –status-all
service <service-name> status
calshow this month
show any month
cal 10 1971
findreturns the full path of matching files, either in full file system (with quotes) or limited to home folder (without quotes)find -name “*my_file.*”
find -name *my_file.*
&run in background
freefree -h -s 3
free -m
tail /path/to/fileprints the last 10 lines of the filetail ./Documents/my_file.txt
sudo tail -f /var/log/syslog
tail -f /path/to/fileprints the last 10 lines and keeps live updating
the output as its added to – useful for live
viewing an updating/live log
sudo systemd-resolve –flush-cachesflush client dns cache (not on Raspbian)
scpSecure CoPy
In this –> example scp copies a file named “” from “host” to the same filename (“.”) on the local machine

scp .
topprints various system capacity usage statistics for each running process, and updates every 3s
interpret output

And package management…

aptapt-get / -cacheDoes what?
apt installapt-get installInstalls package
apt removeapt-get removeRemoves package
apt purgeapt-get purgeRemoves with config
apt updateapt-get updateRefreshes repository
apt upgradeapt-get upgradeUpgrades all upgradeables
apt autoremoveapt-get autoremoveRemoves unwanteds
apt full-upgradeapt-get dist-upgradeUpgrades, handles dependencies
apt searchapt-cache searchSearches for packages
apt showapt-cache showPackage details
Thanks to


Esc + $ Enables soft line wrappingEsc + $ is achieved by pressing and releasing <Esc> then holding <Shift> and typing <4> (Shift+4 = $)

A few Node-RED goodies…

sudo systemctl start node-redRestart Node-RED
cd .node-red
sudo nano settings.js
Edit settings
sudo crontab -eEdit crontab

A few MacOS ones too…

open .Open current folder in Finder from Terminal


To list the size of each database:

select table_schema, sum((data_length+index_length)/1024/1024) AS MB from information_schema.tables group by 1;

Leave a Reply

Your email address will not be published. Required fields are marked *