Wednesday, June 13, 2012

Linux basic user admin commands




#ls –l
 File / Folder listing in a specific  directory
#id <user id>
 To check if the user exists / also to find the UID and groups of the existing user
#finger <user id>
 To check the user last login time stamp/ home directory path / login shell / gecos field
#cat <file name> 
 To read the file which is less than 1 page
#less <file name>
 To read the file which is more than a page
#head <file name>
To read the first 10 lines of the file
#tail <file name>
To read the last 10 lines of the file
#hostname
 To find the hostname of the logged in server
#uname
 To find the flavor of unix OS
#uname –r
 To find the kernel version
#uname  -a
 To find complete info of the server which includes flavor, kernel OS build date
#which <command name>
To find the path of the command which needs to be executed

#/usr/local/bin/sudo /usr/sbin/useradd -u 7014 -g users -d /home/<login id>-m -c "Teju Nagaraj" -s /sbin/bash <login id>
 Command to create a user in Linux server
#/usr/bin/sudo passwd <login id>
 Command to set password for a user
#/usr/bin/sudo /usr/sbin/userdel <login id>
Command to delete the user without deleting home directory
#/usr/bin/sudo /usr/sbin/userdel -r <login id>
 Command to delete the user including home directory
#ssh <hostname>
 Command to remotely login to a different server
#/usr/bin/sudo /usr/sbin/usermod –c ”000/C///lastname, Firstname” <login id>
 Command to modify the gecos filed of a user
#/usr/bin/sudo /usr/sbin/usermod –s <shell name> <login id>
 To change the shell of a user