Last active
November 2, 2021 16:40
-
-
Save AlexLamson/feca37be1e380484c01870140eb12f34 to your computer and use it in GitHub Desktop.
List of useful terminal commands for a beginner. Sorted approximately by difficulty & usefulness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Commands | |
--------------- | |
man # MANual for command | |
ls # LiSt files (-l more information, -R recursive) | |
cd # Change Directory (if no folder, go home) | |
pwd # Print Working Directory | |
mkdir -p # MaKe DIRectory (-p create missing parent directories) | |
touch # create file | |
rm -fr # ReMove directory and all its contents | |
[TAB key] # press tab key to autocomplete filename or command | |
* # wildcard | |
nano # open a file for editing in terminal | |
cat file1 file2 # conCATenate multiple files | |
less # view contents of file | |
cp # copy | |
mv # move (can also be used to rename) | |
find . -name "*.txt" # find files | |
grep # find (in file / in output of other command) | |
history # previous commands | |
clear (ctrl+L) # clear your terminal screen | |
source somescript.sh # execute file in terminal (or use ./somescript.sh) | |
ctrl+U # delete all text to the left of the cursor | |
ctrl+R # search previously typed commands | |
ctrl+C # cancel running command | |
| # pipe output of command on left to input of command on right | |
> # write command output to file | |
>> # append command output to file | |
< # send file on right to command on left | |
!! # previous command | |
exit (ctrl+D) # exit | |
sudo # run command as superuser | |
ping www.google.com # check internet connection | |
wc # word count (-l line count) | |
sort # sort (-r reverse -R randomly) | |
head -20 # view first 20 lines of file | |
tail -20 # view last 20 lines of file | |
ps -aux # process list (static) | |
top # process list (updating) | |
kill # stop some process | |
chmod ugo+rwx file # give user, group & owner read, write and execute permissions to file | |
chown # change owner of a file | |
alias hi #'echo hi' # shorten a command into what you want | |
env # list environment variables | |
export TEST #"test stuff" # set environment variable | |
unset TEST # remove environment variable | |
xargs # run input as command | |
curl -O # download a file from the internet (-O use same filename) | |
wget # download a file from the internet (can download recursively) | |
diff # compare 2 files | |
git diff --no-index # compare 2 files/folders with color highlighting | |
cat foo | tr "a" "b" > bar # replace all "a"'s with "b"'s in file foo and write that to bar | |
tee myfile # write to myfile and to the console at the same time | |
rsync -a --info=progress2 src/foo/ dest/foo # quickly clone a folder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment