linux daily use command for server maintenance

Summary: This post is for sysadmin to review the linux daily use command for server maintenance . I added a short descriptions of each command to know the purpose of the command which you are going to try and use for daily maintenance.

1: pwd
This command show the control on the current directory. It will display the path where my control currently stand from base.

Selection_012

2. hostname
The above command Print the name of the machine which also know is fully qualified domain name.We can use the command netconf (as root) to change the name of the machine.

Selection_013

3. whoami
Print my login name. This command will print UID, GID, effective id and supplementary groups.

Selection_014

4. date

Print the operating system current date, time and timezone.

Selection_015

To set the hardware (BIOS) clock from the system (Linux) clock, I can use the command (as root): setclock

5. time
Determine the amount of time that it takes for a process to complete + other process accounting. . E.g. I can find out how long it takes to display a directory content using: time ls.

Selection_016

6.hwclock
Obtain date/time from the computer hardware (real time, battery-powered) clock.

Selection_017

7.who
Determine the users logged on the machine.

Selection_018

8.w
The w command print users currently login into the system and their login time. it also print the server load average uptime and users activity session.
Selection_019

9. finger user_name
It is a utility and need to be installed on the server. It show you System info about a user.

10. last
Show listing of users last logged-in on your server .It will show you all the login time-stamp from current month first date to current date. Really good idea to check it from time to time as a security measure on your system.

11. lastb

chmod o-r /var/log/btmp

This command will show you the last unsuccessful login attempts on your server. The server log the unsuccessful attempt in a file /var/log/btmp Which is a security threat if not managed carefully. Sometime in urgency we missedup with username and password and type password instead of username which log into the this file. By default the file is readable to all. So we need to change permission from all to root only. The procedure is mention above.

Selection_020

12.history | more
This command will display all the commands executed on the current login page by page.  The history is kept in the file .bash_history in the user home directory (so yes, it can be modified or erased).

13.uptime
Show the amount of time since the last reboot.

14.ps
(“print status” or “process status”) List the processes currently run by the current user.

Selection_021

15. ps axu | more
List all the processes currently running, even those without the controlling terminal, together with the name of the user that owns each process.

16.top
Keep listing the currently running processes on my computer, sorted by cpu usage (top processes first). Press c when done.

Selection_022

17. uname -a
This command will print the unix name will all options.

Selection_023

18. cat /etc/issue
Check what distribution you are using. You can put your own message in this text file–it’s displayed on login.

Selection_024

19.free

free -m, free -g
Memory info (in kilobytes). Using free with -m will show you memory status in MegaBytes and with -g it will show you with Giga Bytes. “Shared” memory is the memory that can be shared between processes.”Buffered” and “cashed” memory is the part that keeps parts of recently accessed files.

Selection_025

20. df -h
(=disk free) Print disk info about all the filesystems (in human-readable form).

Selection_026

21.cat /proc/cpuinfo
It shows the content of the file cpuinfo. The files resides in the /proc directory are not real files , they are hooks to look at the information available to the kernel.

22.cat /proc/interrupts
List the interrupts in use. May need to find out before setting up new hardware.

23.cat /proc/filesystems
It will Show you the current filesystems used by the server.

24.cat /etc/printcap |more
Show the setup of printers.

25.lsmod
(= “list modules”. As root.) Show the kernel modules currently loaded.If you are non root user then run the command like this /sbin/lsmod

26.echo $PATH
Show the content of the environment variable “PATH”. This command can be used to show other environment variables as well. Use set to see the full environment.

Selection_027

27.chage -l my_login_name
If you want to see your password expiry information you have to run the command above.

Selection_028

28.quota
This is a utility need to be installed on the server through yum or through apt-get install. It will show you the limits of Disk Usage.

29.sysctl -a |more
Display all the configurable Linux kernel parameters.

30.runlevel

Print the previous and current runlevel.

Runlevel is the mode of operation of Linux. Runlevel can be switched “on the fly” using the command init. For example, init 3 (as root) will switch me to runlevel 3. The following runlevels are standard:
0 – halt (Do NOT set initdefault to this)
1 – Single user mode
2 – Multiuser, without NFS (The same as 3, if you do not have networking)
3 – Full multiuser mode
4 – unused

5 – X11
6 – reboot (Do NOT set initdefault to this)
The system default runlevel is set in the file: /etc/inittab .

Hope this will help. For technical Assistance you can ping me through contact page of http://wdnec.com

Leave a Reply

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