Welcome. If you are reading this then you are interested about learning linux and/or growing your neckbeard a few more inches. This tutorial will cover the super basic commands and move our way up from there. Expect updates to come and go as i and others attempt to work at this. If you want to help improve this tutorial then send me a PM
Before we can talk about command i need to go over some basics about the system. First thing we need to learn is root. Root is equivalent to Administrator on windows and has complete control over the system. With that kind of power you need to exercise some great caution.
rm -rf /
rm -rf ~/
The top command will delete your root folder and everything in it. the bottom command with delete your home folder and everything in it. Notice how there is only one character missing between the two commands. This is why double checking what you type is very critical to ensure the longevity of your system
Before we can learn about commands we should learn the basic information about the linux filesystem.
Everything in linux is a file. Your harddrive is a file, your videocard is a file, your home folder is a file, the memory google chrome uses is a file, no matter how big that file is. The basic file structure in linux is simple though daunting. There are some basic ones you need to know though.
~/ - this points to your home directory where your files are stored / - this is the root directory. this is equivalent to the C:\ drive on windows /bin - essential binaries for the system are stored here like cat, ls, cp, etc /boot - where the boot files are stored like grub /etc - system wide configuration files are commonly stored here. /home - where user files are stored /proc - virtual filesystem for kernel and memory /tmp - temporary filesystem stored in ram that is reset upon reboot /usr - secondary location for programs and such /var - where log files and temp files are stored
That is filesystem hierarchy but there is a few more things left to cover. There are some hidden files in every directory.
. - Is a special files that is points to the current directory .. - is a special file that points to the folder above the current directory
any file that starts with . is hidden like hidden files and folders in windows
.foo.txt - is a hidden file that hidden normaly in most file managers
now we can move onto some basic commands. These commands will help you move about the terminal and do most of the basic things without that stupid gui being in the way.
cat - prints out the contents of a file
“cat foo.txt” will print out the contents of foo.txt
“cat …/foo.txt” - prints out foo.txt in the folder above the current directory
ls - list the contents of the directory.
“ls” - will print out the contents of the current directory
“ls -l” - will print out more verbose information like owners, permissions, etc
“ls /” - will print out the contents of /
“ls …/” - lists the directory above the current directory
“ls -a” - lists the directory with hidden files like .
“ls -R” - lists the directory and all folders below it
mv - moves files
“mv foo.txt ~/Documents” - moves foo.txt to your documents folder in your home directory
“mv foo.txt …/” - moves foo.txt up a directory
“mv foo.txt foo1.txt” - moves foo.txt to foo1.txt
cp - copies a files
“cp foo.txt ~/Documents” - copys foo.txt to your documents folder in your home directory
“cp foo.txt foo1.txt” - copies foo.txt and names it foo1.txt
rm - removes a file
“rm foo.txt” - removes file foo.txt
“rm -r foo” - recursively removes folder foo and it contents
man - opens the user the manual for a command. not all commands have a man page though
“man foo” - opens the man page for foo
pwd - prints the location of the current directory.
grep - search through a file
“grep foo foo.txt” - searches though foo.txt for the word foo
now that we have commands down we can move onto piping. you can pipe the output of one command into the input of a different command
| - pipes the output of one command into a different command
“cat foo | grep foo”
> - saves the output of the command to a file in overwrite mode. will replace what is already there
“cat foo.txt > cat.txt” - saves the output of cat to cat.txt and replace whatever was in the file.
>> - saves the output of a command in insert mode. will append the output to the file
“ls -laR / >> tree.txt” - saves the output to tree.txt without overwriting anything
that should be able to get you started with most of the basic terminal stuff.
If youre thinking that all of this terminal stuff is cool and want to learn more than L1T has a great video on it over at L1Linux