Useful terminal and shell commands
Be careful withmv
andrm
commands! You can easily overwrite or destroy valuable data. Use with caution. Back up files or use version control!
# Misc (Shell)
wc
- count words, lines, etc.less
- read smth long in terminal instead of printing itgunzip file.gz
- unzip gzipped filesls -R
- recursively list fileswhereis/which
- where is a certain programhexdump
- show bytes. hexdump -vC
is handy.
# Other
awk - execute data queries
cut - awk na minimalkah
grep - search for a particular text
Managing users in Linux
# Tips
ctrl + r
- search history. You can also usehistory
ctrl + a
- beginning of a linectrl + e
- end of a linectrl + w
- delete a wordctrl + u
- delete whole commandctrl + l
- clear screen!!
- last executed command. Forgotsudo
? Usesudo !!
. Doesn’t work in fish.convert file.{jpg,png} => convert file.jpg file.png
cd -
- go to last visited folderpushd, popd
- alternative tocd
, uses stack<( )
- process substitution, treat output like a file (no more temporary files):diff <(ls) <(ls -a)