Linux Commands – A Quick Reference

// March 12th, 2013 // Infrastructure

In an effort to consolidate into one location notes I’ve made over the years listing common linux commands, I’ve chosen to place them into a single post that will be updated as living reference guide.

I want thank the people that have helped me in compiling this listing either by sharing their own notes, or by pointing me in the right direction when I’ve had questions.  (Eric, Kenny, Marcus, Yossef – I mean you guys!).







Linux User and Group Management

Useradds :
useradd -g <group> -c "comment" <username>

Add the group:
groupadd -g <gid> <group>

Add from a list:
cat asdf | while read a;do useradd -g <gid> $a;done

Change passwd from a list :
cat asdf |while read a;do echo <passwd> |passwd --stdin $a;done

Lock account :
usermod -L

Change at next login:
chage -d 0 <user>

Unlock account:
usermod -U

Modify comment: 

Password never expires:
passwd -x -1 username
chage -I -1 -m 0 -M 99999 -E -1 <uid>

Add user to additional group:
usermod -a -G <group to add> <user>

Linux ACL File Permissions

•• ACL must be set in fstab ••

getfacl <file or dir>
(+ at the end if perms mean ACLs are present)

Set user recursive default user perks on dir X:
setfacl -Rm d:u:<user>:rwx <file or dir>
setfacl -Rm u:<user>:rwx <file / dir>

Set user perms on dir X:
setfacl -m u:fldtest:rwx <dir>

Clear all ACL perms:
setfacl -b <dir>

Must give x access or it will not work!

-d = default going forward
-R = recursiave
-m = modify

Filesystems need to be set to use acl... See mount point in /etc/fstab

RedHat Specific Host Configuration


To Change Hostname or IP

to change the hostname/ip it is :

To Add New Interface/IP
This command will be temporary until the interface 
startup script is updated:

ifconfig eth0 netmask up

The following configuration files will need to be updated
for the interface/IP settings on boot.


Update DNS


nameserver <IP ADDRESS OF NS1>
nameserver <IP ADDRESS OF NS2>
nameserver <IP ADDRESS OF NS3>

Update sudoers
Spread the word

    Joshua Johnson

    Joshua Johnson is a Southern California based IT professional specializing in IT Infrastructure, InfoSec, and fighting entropy.

    More Posts

    Comments are closed.