The Ultimate Linux Tutorial part 1

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. Expect a part 2 to come to with how to install programs, edit configs, etc.

i also have a couple other things in the works too like a custom multi-boot flash drive full of linux isos
@Eden @wendell

If youre thinking that all of this terminal stuff is cool and want to learn more than @wendell has a great video on it over at L1Linux

29 Likes

Neckbeard officially grown. Nice work @Dje4321

6 Likes

Defining statement, GUIs are great and all but nothing beats a good command line interface for precise/efficient inputs.

5 Likes

guis are not bad but what is 30 clicks in a gui is a few keystrokes on the terminal

3 Likes

Pretty good stuff. For your 2nd tutorial, I think it would be good to go over editor usage like vim or nano (or Emacs if that's your thing :open_mouth:) as well as basic bash scripting, sed, awk, process management, cron jobs, systemd, basic networking, package management, etc.

1 Like

that stuff comes much later.

next tutorial will be over root things and stuff in /etc, /proc, /usr, etc.

breaking up the posts into smaller portions so i dont overwhelm the users

2 Likes

You forgot dd you fucking newb.

1 Like

i did not forget dd.
that is coming later when i discuss things like root and disk management

twat

2 Likes

dd is a basic tool I use all the time it should be in the first post. Ugh.

dd is a great tool but is dangerous.

this tutorial was about basic terminal commands that had zero risk to the system.

1 Like

Pleb.

1 Like

was a example of the powers of root and how dangerous it can be if your not careful. was a warning not a command.

^This was a warning, not something to try.
the goal of this tutorial was to just introduce users to the terminal
i plan on tackling the mroe advaced stuff later

1 Like

Great stuff! Permissions are arguably more important than most of these commands, maybe good to bring that up next.

was the plan.
was meant as a more basic intro where the users are almost completely safe from bricking a system

Unix Toolbox

/thread

4 Likes

thats pretty neat

Main benefit of TTY is that it has been the same for over 30 years, and with aliases, even new functions are still the same as before.

GUI's have the very annoying property that they are never finished, always a WIP, and follow fashions and subjective paths. TTY is always constant, the world has been doing just fine with ten numbers for a couple of thousand years, many more graphical representations have come and gone, the essence has never changed. All *nix OS's also share the same bash-like shell commands, there is no need to learn any *nix system, if you know bash, you can use and diagnose a previously completely unknown system better than someone who's been trained several years in that system using the GUI.

3 Likes

I can share my Anki flashcards for Linux essentials if you would like.

Someone linked this the other day.

https://linuxjourney.com/

I see some good input about this thread. One of the best ways to learn a subject is to teach it to someone else. I presume this is what the OP is doing. So I will say to the OP to keep on teaching....and don't let the nay-sayers have the last word.
My suggestion is to link a real world example of the "why should I learn this" to each lesson. For myself, I have more interest in learning something that is directly impacting my life. In my case I would like to know how to program a rpi or arduino to control a pwm controlled transfer case re; degrees steering input. This is for my offroad 4x4 racing project. I need to know what language to learn, which cpu is best, how to program..... I don't have any idea where to start but I think learning about linux may help.
I also think you should have two similar threads [linked], one with comments disabled [teaching thread] so the reader can concentrate on your teachings, and one where the comments can help you [learning _what_ to teach] in the directions you teach.
Please carry on,
Thanks.

1 Like