Cheatography
https://cheatography.com
File commands
ls |
Directory listing |
ls -al |
Formatted listing with hidden files |
ls -F |
list files in current directory and indicate the file tyoe |
ls -laC |
list all files in current directory in long format and display in columns |
cd dir |
Change directory to dir |
pwd |
Show current directory |
mkdir dir |
Create a directory dir |
rm file |
Delete file |
rm -r dir |
Delecte directory dir |
rm -f file |
Force remove file |
rm -rf dir |
For remove directory dir |
cp file1 file2 |
Copy file 1 to file2 |
cp -r dir1 dir2 |
Copy dir1 to dir2 |
cp file path |
copy the file to the dir |
mv file1 file2 |
Rename or move file to file2. |
ln -s file link |
Create symbolic link link to file |
touch file |
Create or update file |
cat > file |
Place standard input into file |
more file |
Output the contents of file |
head file |
Output the first 10 kines of file |
tail file |
output the last 10 lines of file |
tail -f file |
Output the contents of file as it grows, starting with the last 10 lines |
File Permissions
chmod octal file |
4 - read(r) 2 - write(w) 1 - execute(x) |
For more options, see man chmod.
Seacrching
grep pattern files |
search for pattern in files |
grep -r pattern dir |
search recursively for pattern in dir |
command | grep pattern |
search for pattern in the output of command |
locate file |
find all instances of file |
|
|
Process Managment
ps |
display all currently active processes |
top |
display all runing processes |
kill pid |
kill process id pid |
killall proc |
kill all processes named proc * |
bg |
lists stopped or background jobs; resume a stopped job in the background |
fg |
brings the most recent job to the foreground |
fg a |
brings job a to the foreground |
System Info
date |
show the current date and time |
cal |
show this month's calendar |
uptime |
show current uptime |
w |
display who is online |
whoami |
who you are logged in as |
finger user |
display information about user |
uname -a |
show kernel information |
cat/proc/cpuinfo |
cpu information |
cat/proc/meminfo |
memory information |
man command |
show the manual for command |
df |
show disk usage |
du |
show direcory space usage |
free |
show memmory and swap usage |
whereis app |
show possible locations of app |
which app |
show which app will be run by default |
Compression
tar cf file.tar files |
create a tar named file.tar containing files |
tar xf file.tar |
extract the file from file.tar |
tar czf file.tar.gz files |
create a tar with Gzip compression |
tar xzf file.tar.gz |
extract a tar using Gzip |
tar cjf file.tar.bz2 |
create a tar with Bzip2 compression |
tar xjf file.tar.bz2 |
extract a tar using Bzip2 |
gzip file |
compresses file and renames it to file.gz |
gzip -d file.gz |
decompresses file.gz back to file |
tag flags:
c - create archive
j - bzip2 compression
t - table of contents
k - do not overwrite
x - extract
T - files from file
f - specifies filename
w - ask for confirmation
z - use zip/gzip v - verbose
SSH
ssh user@host |
connect to host as user |
ssh -p port user@host |
connect to host on port port as uset |
ssh-copy-id user@host |
add your key to host for user to enable a keyed or passwordless login |
Network
ping host |
ping host and outpt result |
shois domain |
get whois information for domain |
dig domain |
get DNS information for domain |
dig -x host |
reverse lookup host |
wget file |
download file |
wget -c file |
continue a stopped download |
|
|
Starting & Stopping
sd -h no |
shutdown system now and do not reboot |
halt |
stop all processes - same as above |
shutdown -r 5 |
shutdown the system in 5 minutes and reboot |
shutdown -r now |
shutdown the system now and reboot |
rebot |
stop all processes and then reboot |
startx |
start the x system |
Shortcuts
Ctrl+C |
halts the current command |
Ctrl+Z |
stops the current command, resume with fg in the foreground or bg in the background |
Ctrl+D |
log put of current session, similar to exit |
Ctrl+W |
erases one word in the current lint |
Ctrl+U |
erases he whole line |
Ctrl+R |
type to bring up a recent command |
!! |
repats the last command |
exit |
log ot of current session |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets