Network Commands
Command |
Description |
Parameter/Usage |
wget |
Downloads something from a web address |
ssh |
Remote login or command run |
"ssh username@server" |
scp, sftp |
Remote file copy |
openssl |
For generating stuff for encryption |
ssh-keygen |
For generating public/private key pairs |
dnf |
Package manager for Fedora. Use it to download, update, and install all sorts of software |
ifconfig |
Use without parameters to get general info on network connections. Also used for assigning IP addresses and setting up networking config stuff for interface devices |
netmask |
Used for setting network submask |
route |
For adding entries to a routing table |
netstat |
For displaying network info |
ip |
For Internet Protocol activities |
traceroute |
Given an address, will identify all of the places your packets travel to to get to that address |
ping |
Sends packets to an IP, seeing how long it takes to get a response |
dig |
Queries DNS servers to get info on a domain |
System & Disk Commands
Command |
Description |
Parameters |
du |
Disk usage; shows disk usage of files in directory |
h: human readable. a: all files, not just directories |
free |
Shows amount of free & and used memory in system |
df |
Report on file system & disk space usage |
lsblk |
Report info about block devices |
fdisk |
Manipulate disk partioning |
l: list disks |
Uname |
Print system information |
export |
For setting an environment variable |
unmount |
Unmounts the specified disk |
eject |
Ejects the specified disk |
Common Commands
Name |
Description |
Parameters/Notes |
ls |
list everything in given directory (default is present dir) |
l: long, more detailed view. a: show all, even hidden files/directories |
cd |
navigate to another directory |
pwd |
Present Working Directory; shows current directory |
cp |
Copy a file from one place to another |
rm |
Remove a file or directory |
f: force remove, ignoring warnings/anything. r: recursive; use this to delete directories |
mv |
Moves a file |
Can be used to rename files, by 'moving' a file to the same directory, with a different name |
rmdir |
Removes a directory |
mkdir |
Creates a directory |
-p to make parents; can build a chain of non-existent directories all at once |
touch |
Updates a file's last-edited date. |
Can be used to create files- it will create a file if the given file does not exist |
history |
lists history of previous commands |
man |
Lists manual page for a given command, that'll tell you alllll about what a command can do and how to use it |
reboot |
Reboots the machine |
|
|
Directories
Directory |
Description |
/etc |
All sorts of system-wide configuration stuff |
/proc/cpuinfo |
CPU info |
/etc/passwd |
User account info |
/etc/group |
Group info |
/etc/shadow |
Where passwords are actually kept |
/etc/skel |
Skeleton, template home directory for copying to make new home directories |
/etc/systemd/system |
Daemon config file / setup stuff |
/etc/syslog.conf |
Configuration for syslog logging daemon |
/var/log |
Where logs are kept |
/etc/hosts |
Configuration for network hosts |
/etc/networks |
Configuration for networks |
Process Commands
Command |
Description |
Parameters/Usage |
top |
Displays and updates lots of info on running processes |
prestres |
Displays current running processes as a tree |
fg |
Foreground; resume a suspended process or bring one back from the foreground |
fg %[job number] or fg [process ID] |
bg |
Background; puts a process into the background |
Note: if you want to put a currently running command in the background, use CTRL+Z, and then fg & bg |
kill |
Kills a command in the background |
Automation and Daemons
Command |
Description |
Parameters |
systemctl |
Managing systems/services, in particular daemons |
journalctl |
part of systemd, can be used to see logging/errors for daemons |
crontab |
Used for setting up automated running of commands / scripts at certain dates or intervals via cron |
at |
For scheduling a command to run just once |
atq |
Lists commands in the queue that have been scheduled to run |
atrm |
Remove a command from the queue |
test |
For checking files and values; any yes/no question about our system |
Input / Reading Commands
Command |
Description |
Parameters |
locate |
For searching for files |
find |
For searching for files |
less |
Text viewer for viewing large files |
nano |
Good, simple text editor |
vim |
Complex, powerful text editor |
vimtutor |
Used for learning vim |
cat |
Concatenate files and print them to stdout |
echo |
Echoes whatever it is given; useful for sending text somewhere |
head |
Read first few lines of a file and print them to stdout |
n: number of lines to read |
tail |
Read last few lines of a file and print them to stdout |
n: number of lines to read |
awk |
Used for viewing files in complex ways, like looping through a file and only looking at certain patterns and columns/rows in a file |
dd |
Reads bytes from a location |
|
|
Groups, Users, and Permissions oh my
Command |
Description |
Parameters |
passwd |
For changing and setting passwords |
useradd |
For adding a new user |
su |
Switch user |
usermod |
Modify a user account |
chown |
For changing ownership of a file / directory |
chmod |
For changing permissions of a file / directory |
groupadd |
Add a group |
Syntax & Jargon
Symbol / Term |
Description |
stdin |
Standard input; the input a command is looking to for what it should work with. Generally comes from keyboard; could be a file or something else, if we redirect stuff |
stdout |
Standard output; typically is the console. Can be changed to a file or something if we redirect it. |
stderr |
Standard error; where errors are printed to. |
| |
Pipe. Used to send output of one command directly to another like, "history | less" |
> |
Send output of command somewhere. |
>> |
Append output somewhere. |
>& or &> |
Send stdout and stderr somewhere |
2> |
Send just stderr somewhere |
1> |
Send just stdout somewhere |
& |
Put at the end of a command to run it in the background, immediately returning console to you. |
$ |
When on prompt, means that you're a regular user |
# |
When on prompt, means that you're the root user |
? |
Wildcard character - when a command receives '?' in its input, it will take that mean to any single character |
* |
Wildcard for any number of characters. I.e. "*.txt" would refer to any thing/file ending in ".txt" |
[abc] |
Wildcard for given characters (here, a, b, or c). Can also define a range, i.e. [1-3] |
CTRL+U |
Delete current line |
CTRL+C |
Abort whatever's currently running |
CTRL+Z |
Suspend whatever's currently running |
Miscellaneous Commands
Command |
Description |
Parameters |
yes |
Spams a string until forcibly stopped |
sudo |
Runs the given command as root |
shutdown |
Shuts down system |
"shutdown now" to do it now |
halt |
Shuts down system |
p: needed on most systems to power down hardware |
reboot |
Same as halt but reboots |
which |
Finds if a command exists and where it is |
whereis |
Like which but searches a broader area than just your shell's search path |
sort |
Sorts text |
r: reverses sort order. h: for sorting human-readable byte counts |
ln |
Used for creating links between files; shortcuts basically |
chsh |
Change shell |
stty |
Setting key commands (like backspace to delete) |
(Use "stty sane" to unbork a borked shell) |
clear |
Clears terminal of text |
script |
Saves everything that comes up in your console, until exit is called |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets