1. Home
  2. Linux
  3. 3 Useful Linux Commands for System Administrators

3 Useful Linux Commands for System Administrators

Many of you would have used Unix/Linux machines in your day-to-day activities. Here i will be showing you some surprises out of the Linux commands you use daily in your activities :

Linux System Administrator Commands
Linux System Administrator Commands

1. CP Command :

Many of you using Linux would have used cp command for sure. But i would not be showing you the usual cp command details, instead i will show you which you might not have known or thought cp command would have this option (-prv) ! Below cp command will give the details of source and destination places the files copied :

# cp rhnplugin.conf ~/test.conf -prv
`rhnplugin.conf' -> `/root/test.conf'

To make cp command to show the progress bar during execution, check out this tutorial.

2. How do I stop creating users on my Linux machine?

If you do not want to create any more user on your Linux box then follow the below steps :

# chattr +i /etc/passwd

Now will see whether this works ?

# useradd user_name

If the solution sucessful, then you should get the below error message :

 useradd: unable to open password file

If you want to revert back the user creation, just follow the below command :

# chattr -i /etc/passwd

3. Kill tty

When i was working on my remote Linux box, suddenly got disconnected from my terminal session. I logged back in and discovered that my old session was still there, only in an idle state. To view who is logged onto a system, there are a variety of commands, each gives a little bit of different information. Some are: w, finger, who, etc. Well, running the finger command will current sessions with pts/0 under the Tty column. Identify the Tty which is idle and run the below command replacing the Tty.

ps -ft pts/0
UID        PID  PPID  C STIME TTY          TIME CMD
root     20955 20953  0 17:18 pts/0    00:00:00 -bash

Use the PID to kill the session using below command :

kill -9 20955
Updated on September 3, 2017

Was this article helpful?

Related Articles

Leave a Comment