3 ms·
Here are some simple but most used ones. # go back to the last directory cd - # run last command with sudo sudo !! # truncate file > /tmp/file-to
by sandreas 3y ago
Here are some simple but most used ones.
# go back to the last directory
cd -
# run last command with sudo
sudo !!
# truncate file
> /tmp/file-to-truncate.txt
# show directory size
du -sh my-dir
# refresh output of command every 2 seconds (needs watch command)
watch ls /tmp
# check how long a command takes
time du -sh mydir
Then I also have a neat function for cd ..:
function ..() {
for i in $(seq 1 $1); do cd ..; done
}
# cd ..
..
# cd ../../../../
.. 4
- amerkhalid 3y ago> cd - git checkout - This was life changing when I first found out about it.