This is a draft cheat sheet. It is a work in progress and is not finished yet.
Commands#1
grep |
searches text files for lines that match |
chmod |
changes a user's permissions |
chown |
change the owner |
pwd |
shows the full path name of the current working directory |
head |
displays the start of a text file |
tail |
displays the end of a text file |
cat |
displays the full text file |
find |
Searches files based on user criteria |
mkdir |
creates a directory |
mv |
movies a file or directory from one location to another |
cp |
copies a file or directory |
wget |
retrieves content from a web server |
whoami |
shows username |
man |
show the man pages of commands |
wc |
counts the number of lines words and characters |
du |
checks disk usage |
rm |
removes objects |
vi |
screen oriented text editor |
nano |
screen oriented text editor |
touch |
create a file |
gzip |
compress/decompress a file |
ssh |
used to remote log into a host |
sudo |
gives temporary root permissions |
sort |
lists files in a sorted order |
rmdir |
removes a directory |
echo |
moves data into a file |
cd |
change directory |
ls |
list the current directory |
|
|
Commands #2
ifconfig |
used to change IP and net mask |
which |
finds the direct path of what you pass to it |
groupadd |
adds a user group |
dnf install |
used to install libraries/packages |
adduser |
adds user |
systemctl |
used to manage a systemd service. (start/enable/restart/daemon-reload/etc) |
journalctl |
used to view system logs for systemd |
pip3 install |
used to install python modules |
source activate |
used to activate a virtual environment |
firewall-cmd |
provides an interface to manage runtime and permanent firewall configuration. |
history |
used to look at your previously input commands |
mount |
mounts file/directory (redirects folder path to another location) |
unmount |
umounts file/directory |
locate |
finds files based of of a database |
su |
used to change the current user |
.(followed by filename) |
Any file that begins with a “.” is hidden. “.” also can be used to reference the current working directory |
ping |
test the reachability of a host on an Internet Protocol network |
netstat |
displays network connections for Transmission Control Protocol |
kill(Ctrl + C) |
used to stop a running process |
traceroute |
displays the route and measures transit delays of packets across an Internet Protocol network |
#!/bin/bash |
used to denote a bash script |
wget |
retrieves content from web servers |
scp |
copies file from one host to another |
exit |
exits the current shell |
clear |
clears the terminal screen |
ln |
creates a symbolic link between two given arguments |
xargs |
executes commands from standard input |
route |
command used to view and manipulate the IP routing table |
|
|
Commands#3
[[...]] |
used to test in a bash script. |
name= |
used to assign a variable. |
if /fi |
marks the start and end of a if statement |
elif |
marks and else if statement in bash |
Spaces in function calls represent different arguments |
for ((i = 0 ; i < 100 ; i++)); |
one example of a bash for loop |
$# |
gets number of arguments |
$* |
gets all arguments |
$1 |
gets the first argument |
$@ |
gets all arguments starting from the first |
for i in {1..5}; |
python style for loop |
do / done |
denotes what to do during a for loop and the end of a loop |
while loop |
loops while something is true |
until loop |
loops while something is false |
return followed by a number is used for error return status |
${name} |
example of how to refer to a variable |
“” |
used to mark a section as a string |
env |
displays all environment variables |
export |
defines an environment variable |
array=([0]=valA [1]=valB [2]=valC) |
an example of how to instantiate an array |
function name() {commands} |
example of a bash functions |
&& |
and operator |
|| |
or operator |
== |
checks if a string equals another |
!= |
checks that string does not equal another |
> |
checks that string is greater than another |
< |
checks that string is less than another |
-lt |
less than for integers |
-le |
less than or equal for integers |
-eq |
equal for integers |
-gt |
greater than for integers |
-ge |
greater than or equal for integers |
-ne |
not equal for integers |
|
|
Commands#4
git clone |
clones a local or remote repository |
git commit |
commits current contents of the index and the given log message describing the changes. |
git push |
uploads local content to a remote repository |
git status |
gets the status of the git repository |
df |
shows disk usage |
enable |
enables and disables shell built-ins |
-a file |
file exists |
-d file |
file exists and is a directory |
-e file |
file exists; same -a |
-f file |
file exists and is a regular file |
-r file |
you have read permission |
-s file |
file exists and is not empty |
-w file |
you have write permission |
-x file |
you have execute permission on file |
-N file |
file was modified since it was last read |
-O file |
you own the file |
-G file |
file's group ID matches yours |
yes |
prints out an infinite loop with the given input |
/ |
root directory |
hostname |
outputs the name of the current computer/server |
write |
sends a message to another user logged in to this computer |
wall |
broadcasts a message to all other users logged in to this computer |
sleep |
pause for a given number of seconds or ms |
umask |
change the default permissions given to newly created files |
cal |
outputs an ASCII calendar |
date |
outputs the current date/time |
read |
reads a value from standard input |
|