An A-Z of Linux – 40 Essential Commands You Should Know
Linux is the oft-ignored third wheel to Windows and Mac. Yes, over the past decade, the open source operating system has gained a lot of traction, but it’s still a far cry from being considered popular. Yet though that may be true, Linux still earns new converts every day. Will you join them?
The learning curve of Linux is what deters most users from even trying it in the first place. It can be a traumatic experience having to go from a GUI-based operating system like Windows or Mac to one that requires command line fiddling. But if you can get over that initial hump of difficulty, you may find that Linux is surprisingly robust.
If you want a crash course on all that is Linux, we’ve got a great Linux newbie’s guide that will teach you all you need to know. For the rest of you who just want a brief overview of some important commands you ought to know, the following list is all you’ll need.
cd - Changes the current working directory in the command line console.
exit - Exits out of the current program, terminates the current command line terminal, or logs you out of a Unix network depending on the context.
kill - Terminates the specified running process. The Linux version of Windows’ “End Process” in the task manager.
ls - List all of the contents of a specified directory. If no directory is specified, it will use the current directory.
man - There’s a running gag in the Linux community that man is the only command you need to know. It stands for manual, and it will give you detailed information on commands and aspects of Linux.
pwd - Displays the current working directory for the command line terminal. Good for when you’ve lost track of where you are in your system.
reboot - Immediately stops all running processes, shuts down the system, then reboots.
shutdown - Stops all running processes and shuts down the system. Parameters can be specified to issue a delayed shutdown or a shutdown at a particular time.
sudo - Runs commands as root, which means no limitations due to permissions.
date - Prints out the current system date and time. Specified parameters can change the format of the output.
df - Reports the disk space usage for the file system.
hostname - Displays the name of the current host system.
ps - Displays information about all of the processes currently running on the system.
quota - Displays disk limits and current disk usage for a specified user. Useful when there are multiple users assigned to a particular system.
top - Displays all of the top processes in the system, by default sorted by CPU usage.
uptime - Reports how long the system has been running since last boot. Extremely useful for servers.
bzip2 - Compresses specified contents into a .bz2 archive or extracts from a .bz2 archive depending on parameters.
chmod / chown - Changes the access permissions of one or more files (chmod) or changes the ownership of a particular file to a new user (chown). Only users with permission or ownership of a file can change that file’s permissions or ownership.
cp - Copies files to a new location with a new name depending on the parameters. Can copy directories too, whether recursively (includes all subdirectories) or not.
find / locate - Searches the system starting at a specific directory and matching all files within that location to a set of conditions laid out by the command parameters. Very useful for quickly finding certain files.
grep – Searches through all of the files in a specified location trying to find files that contain lines that match a given string. Returns a list of all the files that scored a match.
install - Used in conjunction with Makefiles to copy files from one location to the system. Not to be confused with installing packages from a software repository.
mkdir / rmdir - Creates a directory (mkdir) or deletes a specified directory (rmdir). Directories can only be created and deleted within directories that you have permission in.
mv - Moves files and directories to another location. Can be used to rename files and directories by keep their source and destination locations the same.
open – Opens a specified file using the default system application for files of its type.
rm - Remove and remove directory. Used to delete files and directories from the system, whether one at a time or in batch.
tar - Creates a .tar archive or extracts from a .tar archive depending on specified parameters.
zip / unzip - Creates a .zip archive or extracts from a .zip archive depending on specified parameters.
Other Noteworthy Commands
apt-get – Advanced Packaging Tool. Use this command to install, remove, and configure software packages on your system. For a menu-based version, use aptitude command. Available on Debian-based Linux distributions.
ftp / sftp - Connects to a remote FTP server in order to download multiple files.
wget - Downloads files from the Internet at the specified URL to your system.
yum - Yellowdog Updater, Modified. An open source package manager used to easily install software packages from repositories. Available on RPM-compatible Linux distributions.
emacs – One of the most well-known text editors on Unix-like systems.
nano - A newbie-friendly command-line text editor that uses keyboard shortcuts to simulate menus.
vim - Vim is the successor to Vi, both of which are command line text editors for Unix-like systems. Though Vim is popular, it doesn’t use menus or icons for its interface so it has a reputation for being newbie-friendly.
Automatically Shut Down Your Computer After Downloading Has Completed [Windows]
Leaving your computer on to download files can be a smart move, but what happens when the download completes? Your computer will stay powered on, doing nothing but wasting electricity and costing you some money. If you want to leave your computer on to download files, you can have it automatically shut down after the download process completes.
You can also use these tricks to hibernate or suspend your computer instead of performing a full shut down. You’ll still get the power-saving benefits, but you’ll be able to resume your session without losing any data. You can even wake your computer at a time you specify.
SmartPower is an application for automatically turning your computer off and waking it up. You can use SmartPower to set a schedule that controls when your computer will turn off and on. SmartPower can also automatically power your computer off when its CPU isn’t being used, allowing you to have your computer power off when it’s done doing other long-running, intensive tasks.
To have SmartPower automatically power your computer off when a download process is finished, use the Schedules tab to set a Power Off rule. For example, if you usually go to bed around midnight, you can set a rule that will automatically power your computer off at midnight. (You can also optionally have your computer turn back on at a specific time, so it’ll be ready and waiting for you in the morning.)
Next, click over to the Networks tab and enable the Stay on checkbox. Select your network interfaces and specify a traffic threshold. At the scheduled time – midnight, for example – SmartPower will try to automatically shut down your computer. If there’s network traffic, SmartPower will wait until the network traffic drops below your configured threshold (in other words, it will wait until the download is finished) and shut down your computer.
Note that this traffic threshold also takes into account uploads, so take that into account. In other words, if you’re using BitTorrent and your BitTorrent client continues uploading after all downloads are complete, SmartPower will consider the interface active as long as the upload continues.
You can get around this by setting an upload speed limit in your downloading program and setting the threshold in SmartPower above the upload limit, ensuring that uploads alone won’t keep your computer on.
AMP WinOFF is another app you can use to automatically power your computer off when certain conditions occur. It’s more flexible than SmartPower for scheduling shut downs based on network activity. You can have it pay attention only to input (download activity) rather than output (upload activity). Enable the Network transfer trigger in AMP WinOFF, select Input transfer, enter a speed, and select your network adapter.
Once you’re done setting it up, click the Activate button to activate an automatic shut down based on your triggers and settings.
AMP WinOFF works well if you’re stepping away from your computer and want to have it shut down when a download is complete, while SmartPower works well if you want to set up an automatic schedule that shuts your computer down at specific times – except when it’s downloading.
Integrated Shut Down Features & Commands
Many file-downloading programs contain integrated support for automatically shutting down your computer when they’re finished downloading files. They may also contain a “run a program when a download completes” feature, which you can use to run a program that shuts down your computer. The following examples are for uTorrent, but other download applications will often have similar features.
For example, if you’re downloading files with uTorrent, you can click the Options menu, point to Auto Shutdown, and select one of the options to hibernate, suspend (standby), or shut down your computer when your downloads complete.
Let’s say you instead wanted to shut down your computer when a single download completes – perhaps you’re downloading multiple files and only one is important. Or perhaps you’re using an application that doesn’t have an automatic computer shut down feature, but does have a “run a program when download completes” feature.
In uTorrent, right-click a downloading torrent file and select Properties.
Whatever program you’re using, enter the following command into the “run a program” box:
When the download completes, your file-downloading program will run the shutdown.exe command and power off your computer. (If you want to hibernate your computer instead of shutting it down, use the shutdown.exe /h command instead.)
How do you automatically shut down your computer when downloads are complete? Do you prefer another application we didn’t mention here? Or do you leave your computer running overnight instead? Leave a comment and let us know!