In our last few assignments you learnt system administration related task which a normal user can perform. In this assignment I will direct you some handy task for root user. To accomplish this assignment login form root account.

Or to find only in /home partition use
The only argument that is required is a PID, and as many PIDs as desired can be used in a single command. Typically no signal or option is used. Thus, if it is desired to terminate a process with a PID of 485, the following will usually be sufficient:
Know how much space is consumed
This command will show the usages of disk by files and folder. Output of this command show in bytes. To show it in KB use –h switch.
#du
To know that how much space is consumed by any specific file. For example
#du -h [file name]
Command is showing that size of test file is 12 kb.
#du –h test
12 Kb test
Know how much space is available
df command is used to know the available space on any given partitions. For example to know available space on / partition use this command
#df [partition]
#df /
How to find any files
find command is used to find any object in linux. For searching object you can also use locate command but locate command is based on mlocate database. For example to find vinita directory on entire linux use
#find [where to find] – name [what to find]
#find / -name vinita
#find /home –name vinita
How to abort any command
Some time you need to abort any command sequences. For example output of ping will not stop by default. Or some type you miss typed any command and press entered now command prompt is hanged in such a situation use CTRL+C key combination to abort the command in mid.How to locate any command path
shows the full path of (shell) commands.Which command will tell you that which command are you using. By default a user use command form the path set in his profile. Its very handy tool specially in shell scripting.
#which [command]
locate the binary, source, and manual page files for a command
#whereis [command]
How to use history and clear it
history utility keeps a record of the most recent commands you have executed. The commands are numbered starting at 1, and a limit exists to the number of commands remembered—the default is 500. To see the set of your most recent commands, type history on the command line and press ENTER. A list of your most recent commands is then displayed, preceded by a number.Use –c switch with history command to clear the history.
#history
#history –c
Check running process and terminate
The ps ( process status) command is used to provide information about the currently running processes, including their process identification numbers (PIDs). A process, also referred to as a task, is an running instance of a program. Every process is assigned a unique PID by the system
#ps
The -e option generates a list of information about every process currently running. The -f option generates a listing that contains fewer items of information for each process than the -l option. Among the columns displayed by ps -ef, UID contains the username of the account that owns the process (which is usually the same user that started the process) and STIME displays the time the process started, or the starting date if it started more than 24 hours ago.
#ps –ef
The kill command is used on Linux to terminate processes without having to log out or reboot the computer. Thus, it is particularly important to the stability of such systems. Each process is automatically assigned a unique process identification number (PID) when it is created for use by the system to reference the process.
#kill [ps number]
The only argument that is required is a PID, and as many PIDs as desired can be used in a single command. Typically no signal or option is used. Thus, if it is desired to terminate a process with a PID of 485, the following will usually be sufficient:
kill 485
pstree command displays the processes on the system in the form of a tree diagram. It differs from the much more commonly used (and more complex) ps program in a number of respects, including that the latter shows the processes in a list rather than a tree diagram but provides more detailed information about them.
#pstree
how check user set environment
env command will display the environment set for user. A brief description about this output is
#env
EDITOR | Name of editor used. |
HOME | The directory that you are first logged into |
SHELL | The program you run as your command-line interpreter. |
TERM | The type of terminal emulation used |
PATH | Listing of directories searched when logging on |
Location of where the mail is stored | |
MANPATH | Location of your Manuals. |
LOGNAME | The login name |
TZ | Time zone of computer |
how to check CPU run time status
When you need to see the running processes on your Linux in real time, you have top as your tool for that. top also displays other info besides the running processes, like free memory both physical and swap. use q to quit from the output of top commands.
#top
how to set alias for commands
alias command is used to set alias with any command. Mostly alias is used in shell scripting. In our example we set an alias for clear command. Now whenever you need to clear the screen type san instead of clear command. This will work till only you are logged in if want to set alias permanently then do editing in user profile files.
#alias san=clear
uname command is used to gather the system information’s. you can use several switches with commands. Few of them are.
#uname –a
-a, --all
print all information, in the following order:
-s, --kernel-name
print the kernel name
-n, --nodename
print the network node hostname
-r, --kernel-release
print the kernel release
-v, --kernel-version
print the kernel version
-m, --machine
print the machine hardware name
-p, --processor
print the processor type
-i, --hardware-platform
print the hardware platform
-o, --operating-system
print the operating system
--help
display this help and exit
--version
output version information and exit
how to send message to all logged in user
wall sends a message to everybody logged in . The message can be given as an argument to wall, or it can be sent to wall's standard input. When using the standard input from a terminal, the message should be terminated with the EOF key (usually Control-D). The length of the message is limited to 20 lines.
#wall
To shutdown the system
#halt –p
#init 0
To reboot system
#reboot –f
#init 6
#reboot
0 Comment:
Post a Comment