Bash cheat sheet - nadia2603/stage-maykin GitHub Wiki

linkjes

1. Navigating the file system

cd [directory]: change directory

cd ..: go back one folder

pwd: print working directory

ls [option][directory]: list directory contents

mkdir [directory]: create a new directory

rmdir [directory]: remove a directory

cp [source][destinations]: copy files or directories

mv [source][destinations]: move or rename files or directions

rm [options][file]: remove files or directions

touch [file]: create an empty file


2. Archiving and compression

tar [options][files/directions]: create or extra tar archives

gzip [file]: compress a file

gunzip [file.gz]: decompress a gzipped file

zip [archive.zip][file/directions]: create a zip archive

unzip [archive.zip]: extract files from a zip archive


3. File manipulation

cat [file]: output the contents of a file

head [options][file]: output the first lines of a file

tail [options][file]: output the last lines of a file

less [file]: view the contents of a file interactively

grep [pattern][file]: search for a pattern in a file

wc [options][file]: count the number of lines, words, or characters in a file


4. Permissions

chmod [permissions][file]: change the permissions of a file or directory

chown [user:group][file]: change the owner and group of a file or directory

chgrp [group][file]: change the group of a file or directory

umask[mask]: set the default file permissions for newly created files


5. Process management

ps [options]: display information about active processes

kill [process_ID]: terminate a process

top: display and manage the top processes

bg [job_ID]: move a job to the background

fg [job_ID]: bring a background job to the foreground


6. Others

history: show command history

sudo: run as administrator

man <cmd>: read the manual

⚠️ **GitHub.com Fallback** ⚠️