This is a draft cheat sheet. It is a work in progress and is not finished yet.
Files & Directories
cp <file><target> |
copy file to a target |
cp -r <file><target> |
copying of all files in subdir |
mv <file> <target> |
move or rename file |
touch <file> |
create a file |
cat <file1> <file2> |
concaternate files and outputs |
head <file> |
show first 10 lines |
tail <file> |
show last 10 lines |
Group
groupadd <name> |
-g defines the group ID |
|
-p defines the group password |
|
-r reates a system group |
Modify Group
groupmod <name> |
-A adds specific user |
|
-R remove specific user |
|
-n change name of group |
|
|
Locate
locate <file> |
locate particular file |
locate "*.html" -n 20 |
limit search queries |
locate -c |<file>|* |
# of matching entries |
locate -i <file> |
ignore case sensitive |
Password
passwd <user name> |
-l disables acct |
|
-u enables acct |
|
-d rm passwd |
|
-n minimum passwd history |
|
-x days before pw expires |
|
-w warning before expires |
|
-i # of days following the passwd expiration that the account will be disabled |
|
|
Find
find . -name <file> |
file in current dir |
find /home -name <file> |
files under /home dir |
find /home -iname <file> |
remove case sensitive |
find /-type d -name <dir> |
find directory |
find /tmp -type d -empty |
find all empty files |
find /tmp -type f -name ".*" |
find hidden files |
Delete User
userdel <name> |
-r remove users home dir |
|
-f force removal of user acct |
|
|
Add User
useradd <name> |
-d home dir location |
|
-g primary group |
|
-G secondary group |
|
-m creates user home dir |
|
-e date acct will be disabled |
|
-f # of day after pw expires acct is disabled |
User Modify
usermod |
-c change comment fields |
|
-l rename acct |
|
-d rename home dir |
|
-m copy all files |
|
-L lock acct |
|
-U unlock acct |
|
-aG assign secondar group by appending them to any groups the user already belongs to |
|