Help Commands
whatis Search whatis database for complete words; used to find short descriptions of system commands
|
which Shows the full path to shell commands
|
whereis Locate binary, source and man pages for a command
|
apropos Search through a database of short description to find help and man pages containing certain terms and commands
|
man Manual pages for commands
|
Bash Variables
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 |
Partitions and Disk Management
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
|
|
|
Directory Operations
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 |
File Operations
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 |
Searching 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 |
Commands to know
uname |
Prints information about a machine and operating system it is run on |
who |
Print who is currently logged in |
uptime |
Prints system uptime and load |
sudo |
Execute a command as another user, usually with higher permissions |
shutdown |
Bring the system down in a safe way |
|
|
ls Options
-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 |
grep Options
-i |
Case insensitive search |
-r |
Recursive search |
-v |
Inverted search |
-o |
Show matched part of file only |
Process Management
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 |
File Permissions
chmod 775 file Change file permissions to 775
|
chmod -R 600 folder Recursively chmod folder to 600
|
chown user.group file Change file owner to user and group to group
|
File Permission Numbers
First number is the owner permission, second is group and third is everyone |
Calculate permission digits by adding number below: |
suid=4 |
421 |
421 |
421 |
sgid=2 |
rwx |
rwx |
rwx |
flag=1 |
owner |
group |
world |
example
: cmod 777 /etc/file.txt |
|
|
Networking Directories
/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
|
Networking
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 |
Accounts and Security Administration
groupadd Create a new group
|
groupdel Delete a group
|
groupmod Modify definition of a specified group
|
useradd Create a new user
|
userdel Delete a user
|
usermod Modify a user account
|
passwd Update a user's password
|
vipw Edit password, group, shadow-password (Updates etc/shadow)
|
vigr Edit password, group, shadow-group (Updates etc/gshadow)
|
chage Change password policy
|
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets