CLI tips

January 8, 2024, 08:59

oops.se

## TAB completion. tab - Press tab to complete a command or directory tab tab tab - If there are several commands that begins with the same letters then by pressing tab a couple of times will show a list of the similar commands/directories To test this press t and then tab tab tab and you get a list, press i and tab tab tab, see how the list get shorter, press m and tab tab tab it will now change the text to time but after the second and third tab you will see the other matches for time ## Clear the screen crtl + l - Clear screen ## Get back to your home directory cd - Just cd without options or cd ~ will get you home ## Is the command available or do I need to install it? which <command> - It will show if the command is available and where it is in the directory structure whereis <command> - An alternative to which

k9t33n

if you are ever you confused on what a command does add man (short for manual) before it, you can also run man intro for an intro to linux and even man man for a manual on the manual

k9t33n

# Some things to remember - adding sudo before a command gives you more permissions to do things like install packages* - cd [directory] will put you in that directory. As mentioned just cd on its own will bring you back to home - apt is the package manager so when you want to install a package you run sudo apt install <package> And apt install to use apt to install the package. Then when you want to update and upgrade you can run sudo apt update; sudo apt upgrade. - after an update and upgrade you May want to reboot to let all the changes take action sudo reboot - ls lists the files in a directory. - pwd shows your current directory - mkdir makes a new directory - cat shows the contents of a file - nano let's you edit a file

illegitimate_egg

# Reusing commands To use the last command again press the up arrow key You can keep doing this or press the down key to go through your command history

k9t33n

You can also type history to see your full command history in text