Skip to content

Latest commit

 

History

History
142 lines (122 loc) · 1.89 KB

cheatsheet_command_line.md

File metadata and controls

142 lines (122 loc) · 1.89 KB

Hello, world!

echo 'Hello, world!'

Stop (SIGINT) any running foreground process in terminal with keypress:

# Ctrl+C

Don't get lost

whoami
echo $USER
pwd
echo $PWD
echo $SHELL
clear
# Ctrl+L works similarly like "clear"

Update, list and install packages with apt

sudo apt update && sudo apt upgrade -y
apt list --installed
sudo apt install cmatrix
sudo apt install htop cowsay fortune neofetch tldr ncal

Fun stuff

cal
cowsay 'Mooooooooooooooohhhh1!!111!!'
fortune
fortune | cowsay -f tux
cmatrix

Learn all about packages

whatis cal
whereis cal
which cal
type -a cal

Learn all about commands

man cal
tldr cal

Get to know your pc

top
htop
free -h
df -h
ps aux
uname -a
echo $LANG
neofetch
lsb_release -a

Change directory

cd
cd ~
cd ..
cd -
cd /
cd /path/to/another/directory/

Display directory content

ls
ls -l
ls -a
ls -a -l
ls -al
ls -la

Create empty file(s)

touch file1 file2 file3
touch notes_{3..6}-{w..z}

Open a file and edit it

nano myTextFile
vim anotherTextFile

View a file

cat myTextFile
less showTextFileButScrollable
head firstTenLinesOfTextFile
tail lastTenLinesOfTextFile

Copy, move and remove files

cp /path/of/original/file /path/to/new/destination/
mv /old/path/file /new/path/
rm oneFile anotherFile aThirdFile
# use the -i flag to make the commands interactive/less "dangerous"

Find a file

# find a file by extension, "*" is a wildcard
find root_path -name '*.ext'

Create directory/directories

mkdir directory1 directory2 and many more directories
mkdir {2024..2030}_{1..12}_photos-collection

Delete an empty directory

rmdir emptyDirectoryName 

Start gitk and do not let it block the terminal with ampersand (&)

gitk &

Open a bash inside bash and exit bash

bash
exit