What are the Basic Linux Commands you need to know?

December 29, 2022
Linux

All Commands

Command Discription
ssh Used anywhere to connect to other machines by specifying the username@ipaddres of the server you want to connect to.
Example: ssh username@10.10.1.20 accept all fingerprints and type the password
ls Lists all files in your current directory.
Specific options: ls -l for a nice list and ls -al for including all the hidden files.
pwd To find out where you are located. Output: Your current directory
Example /home/username
cd Cange direcotry. Directly after "cd" you can specify where you want to go.
Example: Root of the file system cd / or a specific path cd /usr/bin, with cd .. you can jump back one directory, cd with space will take you back to the home directory
touch Is one of the quickest and easiest way to create a file.
Example: touch file.txt or multiple files touch this is a nice command(this, is, a, nice, command are created) or touch file{1..10}(file, file1, file2 etc.)
echo Allows you to output something in the terminal echo Hello World! or you can use it to add stuff to your file really quickly echo "Stuff to add" > neworexistingfile.txt
nano To edit new or existing files.
Example: nano filename.nice now you can edit the file. To save ctrl+x Y and enter
vim To edit new or existing files.
Example: vim file.name hit I to start inserting text and ESC Colon(:) and wq to write and quit.
cat To see waht is in a file really really quick.
Cat and then file name: cat file.name
shred To shred a file so nobody can ever see what's in that file.
shred file.name
mkdir Create new directory, simply mkdir and file name
mkdir newdirectory
cp To copy a file by cp file to copy and then where you want to go it
cp file.name directory
mv For moving files. By mv, specify the and then where you wanna put it.
mv file.name directory
rm To remove or delete a file.
rm file.name
rmdir To remove a direcotry rmdir directory. If it's not empty, go back to the rm command an do a -r for recursive
rm -r directory


I hope it will help you as a little cheat sheet.