Thursday, May 15, 2014

8:02 PM
Good day!

Today were gonna learn some brief overview of some UNIX commands that is often use when working on a nix* systems.


su

su - change user ID or become superuser

su [login name]

The su command allows one to switch user to a super user to a user. It allows a Linux user to change the current user account associated with the running console. Very important could be used to switch to suer user accounts.

Usage:

$ su root
password:
#

This su command will be monitored in /var/log/auth.log(in some linux variants) and this file of all files is carefully monitored by the system administrator. Here's how it looks:





There! you would know that index- is switched to the root account on May 16, 03:30:13 hours.


Searching for valid login names:

using who..
show who is logged on. Command informs the user of other other users on the system.

$ who
root            tty1      2014-05-16 02:06
index-       tty7      2014-05-16 02:06
index-       pts/1    2014-05-16 02:06 (:0.0)


tty is the users terminal, date, time each logged on. root, index- are valid logins. You can either use $who or $w


more UNIX commands: 

man [command] or [c/r] - will give you the commands manual pages.

help - list available command on some UNIX systems.

mkdir [dir name(s)] - makes a directory.

rmdir [dir name(s)] - remove directory. You wont be able to remove the directory if it contains files in them.

rm [file name(s)] - remove files. rm * will erase all files in the current dir so you better be careful of using this. 
Some options are:
-f // unconditional removal 
-i // Prompts/ask user for y or n

write [login name] - to write to other user's terminal, some sort of chat.

mesg [-n] [-y]  - doesn’t allow others to send you messages using the write command. Wall used by system administrator will overrides it.

$ [file name] - to execute any file that you have permission +x to run.

wc [file name] - Count words, characters, lines in a file. Very useful when piping.

stty [modes]  - Set terminal I/O for the current devices.

sort [filename] - Sort and merges files many options.

date [+%m%d%y*] [+%H%%M%S] - Displays date according to options.

at [-r] [-l] [job] - Does a specified job at a specified time. The -r removes all previously scheduled jobs. The -l reports the job number and status of all jobs scheduled.  

If you have some additional commands that is commonly used. You can add them into the comments below.

Thanks :-)

0 comments:

Post a Comment