Download the authoritative guide: Cloud Computing 2019: Using the Cloud for Competitive Advantage
Modern Linux desktop environments have gained popularity because they're easy to use and have a more attractive design than the Linux GUI experience of years past.
Despite these milestones, Linux commands that are run from a terminal are still needed -- and extremely useful for the end-user. In this article, I'll share some commonly used commands for use on your Linux desktop, in addition to some great commands that can save you time.
One of my favorite commands is the cp command. Easy to use, it's useful for copying one file from one location, to another. An example might be something like this:
cp importantfile newimportantfile
This command makes an exact copy of one file within the same directory. You're also free to change the directories if you like, such as:
cp /home/$USER/importantfile /home/$USER/Desktop/newimportantfile
This command will then copy the target file from the user's home directory over to the user's desktop directory.
One last tip for this command is the ability to create a symlink. To create a symlink (symbolic link) to a file using the cp command, you would type the following:
cp -s importantfile newimportantfile
Using the above command will create an executable shortcut to the original file. This is a nice function in that you can create an executable link to another file you might not otherwise want to relocate for whatever reason.
Much like the dir command, using ls also provides you with a complete file list when run in a specific directory. Where ls begins to distinguish itself is in its ability to arrange files listed. For example, I can use ls to list my files with their corresponding dates and times:
Another useful approach is using ls to sort a list of files, but ignoring the ~backup files for each file listed. Most commonly found with text files, ~backups can be a distraction. So this command is useful in sorting them without the backups filling up the list.
Every once in a while, you're going to have a rogue program that isn't functioning as expected. When this happens, I've found the killall command is the best approach to putting it out of your misery. Unlike its cousin, the kill command, the killall command offers greater flexibility when you don't know the PID. Granted, you could run the ps command to gain the PID for the misbehaving program...however this isn't always practical – especially when it's slowing down your workstation.
To use kill all, you only need know the name of your executable program. For example, if Google Chrome is locking up, you can kill the program with the following:
killall -v chrome
The above command not only kills Chrome dead in its tracks, it uses the verbose argument to let you know it's dead and not still running in the background somewhere.
Relying on network manager is a common newbie mistake, especially when they're dealing with network issues. I've seen instances where network manager shows someone as being connected to the network, when in fact they weren't. To counter this, I prefer to take matters into my own hands by using the ifconfig command. By itself without any options used, ifconfig will give you a clear idea of your IP address, data transferred, among other related information.
To use ifconfig to connect to the network in your office, you can simply use the following two commands: [continued on next page]
This will give you an idea what the name of your device is called. Under Ubuntu, it's likely to be something like eth0 or eth1. Other distributions however, will likely have a different variation. In any case, make a note of it. Then disconnect the device with the following:
ifconfig eth0 down
With the workstation now disconnected from the network, you're ready to reconnect it.
ifconfig eth0 up
This brings up the wired interface, reconnecting it to the network. With wired connections, this usually works flawlessly.
Sometimes you will be presented with a situation, where you need to make a directory. In the event this can't or shouldn't be done from a GUI, doing so from the Linux command line can prove to be useful. To create a new directory using the terminal, simply type the following:
To take the mkdir command even further, you can also choose specific directory permissions by using the following command:
mkdir -m 200 NameOfNewDirectory
The above command created a new directory with permissions allowing for write only, for the owner of the directory. You can learn which permissions are right for your directory, from this article on chmod.
Passwords are often thought of as a mixed blessing. Remembering how or when to update them, for the sake of keeping security in check, is an even bigger problem. Most users will try to change their passwords from a GUI and usually this works. However, I've found that using the Linux command line to change passwords will not only provide greater success, but also give greater control overall.
To change your own user password, use the following command:
This will prompt you for the new password – press enter. Then you'll be asked to confirm it by retyping it. After hitting enter again, you'll be alerted to the password being updated successfully. The same approach also works for the root user, so long as you know the original root password.
To enable password aging, where a set password expires and needs to be reset with a new one, follow these commands closely (as root):
Locate the section containing PASS_MAX_DAYS 99999.
Change PASS_MAX_DAYS 99999 to something reasonable to say, 60 days.
The next setting you'll want to change is how many days ahead of time the user will be alerted to when they need to change their user password. Look for this section, change it to something reasonable like five days. By default, it's already set to seven.
You can dive deeper into these settings, but for most situations, this will work just fine for new users being added to a workstation. For existing users however, you will need to use the chage command line tool.
On the surface, relying on the Linux command line might seem dated and perhaps even silly. But for those of us who understand how versatile and powerful using the command line can be, the list of commands above are a mere sample of the tremendous power available at our finger tips.
Next time you need to create a directory, change a password or even troubleshoot a network connectivity issue, consider using your Linux terminal first. The end result might surprise you.