Back to Linux Tips and Guides page
Basic common commands to be used in a Terminal session, or healess operating system. These should be enough to get a beginner going.
From the desktop, press Ctrl, Alt, T together. Alternatively in Unity use the launcher to search for Terminal, or in Gnome, browse to Terminal through the menu.
After typing the following commands, run the command by pressing the Enter / Return key.
NOTE: Please read to the guidance on Filenames With Spaces to save a few headaches...
"CoPy"
To copy a file: ~$ cp "from directory name"/"file name" "to directory name"/"file name"
NOTE: You can also rename files using cp, just by specifying a new name in the 'to' directory filename
"MoVe"
To move a file: ~$ mv "from directory name"/"file name" "to directory name"/"file name"
NOTE: As with cp, you can also rename files using mv, just by specifying a new name in the 'to' directory filename
"ReMove"
To delete a file: ~$ rm "directory name"/"file name" Or if you are in the directory containin the file, just ~$ rm "file name" will do.
"ReMove DIRectory"
To delete a directory: ~$ rm "directory name"
"MaKe DIRectory"
To create a directory: ~$ mkdir "directory name"
"Change Directory"
Navigate from current directory to a subdirectory ~$ cd "directory"
To jump to a different directory ~$ cd /"directory" or ~$ cd /"directory/subdirectory"
"LiSt"
Lists / shows / displays the contents of the current directory: ~$ ls
"Super User DO"
Carry out a command with Super User (root) permissions
WARNING:
sudo allows you to make changes to your system that are normally locked.
I once accidentally formatted my computers main hard drive (while using it) by not taking enough care when logged in as root, I was intending to format a camera SD card but picked the wrong drive while rushing and tired...
Golden Rule: don't get complacent while logged is as Root or Super User, you can end up in trouble...
This properly stops all running commands: ~$ sudo shutdown
To make this a complete shutdown, add -P to turn off the power, however, shutdown needs to know when you want the shutdown to happen, enter now for it to take immediate effect.
~$ sudo shutdown -P now
Following on from shutting down, the same command can be used with -r instead of -P.
~$ sudo shutdown -r now