[last updated: 2025-08-07]
Linux home page
top 50 Linux commands (from: digitalOcean)
file and directory commands:
Linux script files
mounting external storage devices
(link to:) tecmint on systemd & systemctl
-----
On This Page:
- General Notes:
- General Commands:
apt-get update & upgrade, clear, who, date, inxi, startx
- Conditional & Loop Commands:
- SSH:
- Transfer files between computers:
- File and Directory Commands:
- File commands:
cp, mv, rm, find
- Directory commands:
pwd, cd, mkdir, rm
- Ownership and Permission commands:
chmod, chown
- System Commands:
ps, df, raspi-config, reboot, shutdown, dpkg, cat /proc/version and other variations, uname, python --version
- GParted
- Mounting external storage
- Other Commands:
sudo, su, exit, lsusb, ls -l, whoami, chown, arecord -l, aplay, echo $PATH, dmesg, ifconfig, ssh
===============================================================
-----------------------------------------------------------------
- General commands:
- Before installing anything new (or even more often), do these commands:
$ sudo apt-get update
$ sudo apt-get upgrade
- $ sudo apt-get update ... synchronizes packages on your system with repository.
- $ sudo apt-get upgrade ... upgrades all installed packages
This step takes a few minutes to complete.
- However recently saw recommendation to use dist-upgrade instead of upgrade.
I confess I didn't understand the explanations of the differences,
More study needed, but for now I'll stick with upgrade.
- There is also confusion over whether to use apt or apt-get.
Best advice I've seen is that for Linux Mint, apt is sufficient
- $ reboot ... as name implies...
- $ shutdown -h now ... as name implies...
- $ clear ... clears terminal screen
- $ whoami ... the name of current user
$ who ... the name of the current user, the terminal they are logged in at, the date and time when they logged in. If it is a remote session, it also tell where they are logged in from.
- $ date ... gives current date
$ sudo date -s "18 APR 2023 07:25:00" ... change date if wrong and offline
- $ inxi -Fxz ... gives printout of hardware
- $ startx ... Opens the GUI (Graphical User Interface)
However this opens automatically on my installation, so I'm not sure when you'd need to use this...
-----------------------------------------------------------------
- Conditional & Loop Commands:
-----------------------------------------------------------------
- SSH:
Suppose you have a "Local Computer", and you want to use it to log into a "Remote Computer".
Executing SSH on the local computer will allow you to log into the remote computer using your local keyboard.
Both computers must be on the same network.
Note, (I think...) this only allows using command-line control, not viewing the entire desktop...
-----------------------------------------------------------------
- Transfer files between computers:
- $ scp [source] [destination]
You do NOT need to use ssh to log into remote computer.
The scp command does that automatically, and logs you out again when done.
- copy a file from a local computer to a remote computer:
log in to local computer
open terminal in local computer
$ scp [path to source file on local computer] [username on remote computer]@[IP of remote computer]:[path to file destination on remote computer]
you will be prompted for password of the remote computer
- copy a file from a remote computer to a local computer:
log in to local computer
open terminal in local computer
$ scp [username on remote computer]@[IP of remote computer]:[path to source file on remote computer] [path to file destination on local computer]
you will be prompted for password of the remote computer
- copy a directory:
$ scp -r ...
-----------------------------------------------------------------
- File and Directory Commands:
-----------------------------------------------------------------
Other Commands:
- $ sudo & su:
- sudo is used in front of many commands in order to invoke one-time root privilege.
- $ sudo su ... will change user to root, so that any commands executed will have root privilege, and 'sudo' is not needed with each command.
- $ exit ... to leave superuser status and return to standard user status.
- $ lsusb ... shows all USB devices attached
Especially helpful in troubleshooting Arduino connection issues
- $ cat /etc/passwd ... shows all defined users
- $ whoami ... gives name of current user
- If you wish to change ownership of all files inside a directory, you can use the -R option:
$ sudo chown -R [user] [path/directory/]
- $ ls -l ... shows owner
- $ arecord -l ... list of all audio devices connected
- $ sudo aplay -l ... list of "devices"
use: "hw:X,Y", where X is "card number", and Y is "device number"
- $ which [some command]
will return the directory where the command executable is located.
- $ echo $PATH
prints out the current system variable PATH
To add another folder to the PATH variable, use:
$ PATH=$PATH:~/opt/bin
-or- to add it temporarily...
$ export PATH="/[dir to add]:$PATH"
-or- to add it permanently, edit /home/.bashrc
and add this line to the end of the file:
export PATH="/Directory1:$PATH"
save, exit, reboot (or just execute the script - how??)
- Investigating drivers/modules:
- $ dmesg
$ dmesg | grep [module/driver name]
- $ time [ command ]
- This command prints out the time consumed to execute the command
- $ ifconfig
prints out a bunch of stuff, among which is the IP address of your computer
This address will usu be dynamic, ie the next time you {log in? reboot?]... you'll have a different IP address
- ports and sockets: (link to:) tecmint
- diff ... investigate this - it compares two files and can print out the differences ...
.
.
.
eof