CentOS: Bash Variables Cheat Sheet

envList current enviro­nment variables
echo $NAMEOutput value of $NAME variable
export NAME=­valueset $NAME to value in enviroment
setChange value of shell atrributes and positional parameters or display list of shell variables and functions
$PATHExectuable search path
$HOMEHome directory
$SHELLCurrent shell

CentOS: File Operations Cheat Sheet

catPrint a file on the screen, concat­enate files
touchCreate an empty file, change file timestamps
cpCopy direct­ories or files
mvMoves direct­ories or files
rmRemoves direct­ories or files (This is how you remove recurs­ively)
lnCreates a symbolic or hard link for a file
lessView a file on page at a time, allows for going backwards
headPrint the first 10 lines of a file
tailPrint the last 10 lines of a file
wcCount the number of words or characters in a file
statDisplay file of file system status
cutRemove sections from lines of input
pasteMerge lines of files

CentOS: Searching Files Cheat Sheet

grepSearch text files for lines containing a matching pattern
locateFind files by matching the whole path name
findsearch for files in a directory hierarchy

CentOS: ls Options Cheat Sheet

-aShow all (including hidden)
-RRecursive list
-rReverse order
-tSort by last modified
-SSort by file size
-lLong listing format
-1One file per line
-mComma-­sep­arated output
-QQuoted output

CentOS: Process Management Cheat Sheet

psReport on current processes
pstreeDisplay a tree of processes
topShow real time processes
killTerminate a process by PID
kill­allKill a process by name
pkillLook up or signal processes based on same and other attributes
pgrepGrep for process inform­ation
ctrl+zStop the job but don’t end process
&Place this after a command to put the process in the background
jobsDisplay all jobs

CentOS: File Permissions Cheat Sheet

# Change file permis­sions to 775

chmod 775 file

# Recurs­ively chmod folder to 600

chmod -R 600 folder

# Change file owner to user and group to group

chown user.g­roup file

CentOS: Networking Direct­ories Cheat Sheet

/etc­/sy­sco­nfi­g/n­etw­ork­-sc­riptsThis folder contains the config­uration files for each interface on the system; usually named ifcfg-eth0 or ifcfg-­eth1.
/etc­/re­sol­v.c­onfThis file contains the permanent Domain Name Server (DNS) settings

CentOS: Networking Cheat Sheet

ifco­nfigConfigure network interface
routeShow/M­ani­pulate the IP routing table
ipShow/M­ani­pulate routing, devices, policy and tunnels; replaces ifconfig, arp, and route
ifupBring network interface up
ifdownBring network interface down
pingSend ICMP ECHO_R­EQUEST to network hosts

CentOS: Security Admini­str­ation Cheat Sheet

Create a new groupgrou­padd
Delete a groupgrou­pdel
Modify the definition of a specified groupgrou­pmod
Create a new useruser­add
Delete a useruserdel
Modify a user accountuser­mod
Update a user’s passwordpasswd
Edit password, group, shadow­-pa­ssword (Updates etc/sh­adow)vipw
Edit password, group, shadow­-group (Updates etc/gs­hadow)vigr
Change password policychage