Linux commands : Part 2

Despite using Linux as working environment for last couple of years, there are time when I forget some commands, specially at the time of needs. I have to gogole them to refresh my memories. Some of those commands may not be used frequently and some even once in a period. Remembering them when you are not system admin is tough task, and I find it particular hard as I tend to forget them even more often.

So, I decided to jot it down here. I discussed 10 basic linux commands that every starter should know in my previous post Basic Linux command for starter . Here you will find others.

1) Chown
Chown is used to change the user of the file. It can only be done if you are root or the owner of the file.

> chown username filename

It will change the owner of the file ‘filename’ to ‘username’.

> chown username:usergroup filename

It will change the owner of the file ‘filename’ to ‘username’ with group assign to ‘usergroup’.

> chown username directoryname

It will change the owner of directory but not it’s content.

> chown -R username directoryname

R stands for recursive and this command change the owner of directory along with the content to ‘username’.

> chown -v username directoryname

V stands for verbose and it will list out the process that were preformed when changing the ownership. This command is specially useful when changing mass file ownership.

2) ps
ps : Process status, is use to report the process and it’s status to user.

> ps

ps alone will list current running process.

> ps aux

It will list the all running process in system with details like processor id, cup & memory resource it is using, with user that own the process etc

> ps -ef

Display full information about each of processes currently running.

For more detail in ps command, try ps -help in console.

3) kill
This command is use to kill or terminate the currently running process. I find it very useful when flushing the clogged process.

> kill pid

Kill/terminate the running process by given pid number. The pid number can be viewed by using ps command along with syntaxs.

4) ifconfig
System uses “ifconfig” at boot time to define the network address of each interface on a machine. Also we can use it to redefine an interface’s address or other parameters.

ifconfig -a

list all interfaces

ifconfig wlan0:1 netmask

To add a second IP address to wlan0:

ifconfig eth0 hw ether 01:02:03:04:05:06 

To change the hardware address (MAC address) assigned to eth0 (useful when setting up a router for a DSL or cable modem):

5) passwd
Create or change a password associated with a user name. Only the owner or a privileged user may change a password.

> passwd options username

6) mount

> mount options device 

It’s a system admin command, that is used to mount/load a drive on a directory. The directory, must already exist and should be empty, becomes the name of the root of the newly mounted file structure.

> mount -l driveLabel 

Mount a drive with given label.

> mount -U driveUUID

Mount a drive with drive’s UUID.

7) login
Log into the system for user and with password (if available).

> login username option

After successful, login updates accounting files, sets various environment variables, notifies users if they have mail, and executes startup shell files.Only the root user can log in when /etc/nologin exists.

> login guest -f

Where -f is an option that suppress second login authentication

Join the Conversation


Leave a comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.