env | List current environment variables |
echo $NAME | Output value of $NAME variable |
export NAME=value | set $NAME to value in enviroment |
set | Change value of shell atrributes and positional parameters or display list of shell variables and functions |
$PATH | Exectuable search path |
$HOME | Home directory |
$SHELL | Current shell |
Tag: CentOS Cheat Sheet
A CentOS cheat sheet includes commands to help you using CentOS. CentOS is a Linux distribution that provides a free, community-supported computing platform functionally compatible with its upstream source, Red Hat Enterprise Linux (RHEL). Below are CentOS simple cheat sheets.
df | Report file system disk space usage |
mount | Show whats mounted or mount a file system |
unmount | Unmount a file system |
fuser | Identifies processes using files or sockets |
isof | list open files on the system |
clear | clears your screen |
pwd | Shows current directory |
cd | Change directories |
ls | List directory contents |
mkdir | Create a new directory |
rmdir | Delete an empty directory |
cat | Print a file on the screen, concatenate files |
touch | Create an empty file, change file timestamps |
cp | Copy directories or files |
mv | Moves directories or files |
rm | Removes directories or files (This is how you remove recursively) |
ln | Creates a symbolic or hard link for a file |
less | View a file on page at a time, allows for going backwards |
head | Print the first 10 lines of a file |
tail | Print the last 10 lines of a file |
wc | Count the number of words or characters in a file |
stat | Display file of file system status |
cut | Remove sections from lines of input |
paste | Merge lines of files |
grep | Search text files for lines containing a matching pattern |
locate | Find files by matching the whole path name |
find | search for files in a directory hierarchy |
-a | Show all (including hidden) |
-R | Recursive list |
-r | Reverse order |
-t | Sort by last modified |
-S | Sort by file size |
-l | Long listing format |
-1 | One file per line |
-m | Comma-separated output |
-Q | Quoted output |
-i | Case insensitive search |
-r | Recursive search |
-v | Inverted search |
-o | Show matched part of file only |
ps | Report on current processes |
pstree | Display a tree of processes |
top | Show real time processes |
kill | Terminate a process by PID |
killall | Kill a process by name |
pkill | Look up or signal processes based on same and other attributes |
pgrep | Grep for process information |
ctrl+z | Stop the job but don’t end process |
& | Place this after a command to put the process in the background |
jobs | Display all jobs |
# Change file permissions to 775
chmod 775 file
# Recursively chmod folder to 600
chmod -R 600 folder
# Change file owner to user and group to group
chown user.group file
/etc/sysconfig/network-scripts | This folder contains the configuration files for each interface on the system; usually named ifcfg-eth0 or ifcfg-eth1. |
/etc/resolv.conf | This file contains the permanent Domain Name Server (DNS) settings |
ifconfig | Configure network interface |
route | Show/Manipulate the IP routing table |
ip | Show/Manipulate routing, devices, policy and tunnels; replaces ifconfig, arp, and route |
ifup | Bring network interface up |
ifdown | Bring network interface down |
ping | Send ICMP ECHO_REQUEST to network hosts |
Create a new group | groupadd |
Delete a group | groupdel |
Modify the definition of a specified group | groupmod |
Create a new user | useradd |
Delete a user | userdel |
Modify a user account | usermod |
Update a user’s password | passwd |
Edit password, group, shadow-password (Updates etc/shadow) | vipw |
Edit password, group, shadow-group (Updates etc/gshadow) | vigr |
Change password policy | chage |