Skip to content

Instantly share code, notes, and snippets.

@CelvinBraun
Created December 7, 2022 08:52
Show Gist options
  • Save CelvinBraun/a4e9d3f2f049abd3427d857289898f8d to your computer and use it in GitHub Desktop.
Save CelvinBraun/a4e9d3f2f049abd3427d857289898f8d to your computer and use it in GitHub Desktop.
Linux - basic commands
pwd ->shows current path
ls ->shows files in current path
ls -l ->shows files with right in current path
ls -la ->shows files with right in current path + invisible once
cd Downloads/ ->changes directory to folder "Downloads"
cd .. ->changes directory to folder above
cd ->changes directory to home folder
mkdir test ->creates a folder named "test"
touch test.txt ->to create a file named "test.txt"
wget https://en.wikipedia.org/wiki/Wget ->lets you download the wiki page to wget
du -h Wget ->shows the filezise of your newly downloaded article. -h makes it more readable
cat test.txt ->to see the content of the file
head test.txt ->shows the first line of file
tail text.txt ->shows the last line of file
mv text.txt Downloads/ ->moves the file to "Downloads/"
mv Downloads/test.txt . ->moves the file back to current path
cp test.txt ~/Downloads/test.txt ->creates a copy of the file in another folder
rmdir test ->will remove the directory
rm test.txt ->removes the file
find ~ -name test.txt ->searches for a file name in a certain directory
locate test.txt ->locates all files with certain name in filesystem
ps ->shows running processes in shell
top ->shows an overview of current running processes
strg+c (keys) ->exit out of command like top
free ->shows memory usage
uptime ->shows uptime of system
uname -a ->gives information about system
whoami ->shows current used user
groups ->shows the groups you're in
passwd ->to change password of user
passwd test ->to change the password of user test
w ->shows logged in users
alias ipconfig=ifconfig -a ->creates an alias, where can get used as shortcut (you can just enter ipconfig (Windows))
clear ->clears terminal screen
man chmod ->opens the manual for chmod command, to explain you how to use it
history ->shows the comand line history
poweroff ->turn system off
reboot ->lets system reboot
exit ->exits console
sudo ->added in front of command to do it as superuser
sudo!! ->in case sudo gets forgetten and you want to repeat last command as superuser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment