Linux Commands: Video of Time-Saving Commands: Page 2

A look at some Linux commands that save time and improve work efficiency. 
Posted September 17, 2013
By

Matt Hartley


(Page 2 of 2)

ifconfig

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.

mkdir

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:

mkdir NameOfNewDirectory

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.

passwd

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:

passwd YourUserName

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.

If you need to change your root password, because you forgot it, you can use the following tutorial for Ubuntu users. For other distributions, try this root recovery article.

To enable password aging, where a set password expires and needs to be reset with a new one, follow these commands closely (as root):

nano /etc/login.defs

Locate the section containing PASS_MAX_DAYS 99999.

Change PASS_MAX_DAYS 99999 to something reasonable to say, 60 days.

PASS_MAX_DAYS 60

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.

PASS_WARN_AGE 5

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.

Final thoughts

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.


Page 2 of 2

Previous Page
1 2
 



Tags: open source, Linux, Linux desktop


0 Comments (click to add your comment)
Comment and Contribute

 


(Maximum characters: 1200). You have characters left.