0% found this document useful (0 votes)
37 views

The Linux Survival Guide

This document provides an overview of basic Linux terminal commands and directory structure for beginners. It introduces common commands like ls, cd, mv, cp, rm, and cat. It explains the Linux directory structure including important directories like /bin, /sbin, /etc, /usr, /home, /opt, /tmp, and /var. It also discusses users and permissions, explaining where user information is stored in files like /etc/passwd and the encrypted passwords in /etc/shadow. The goal is to provide newcomers to Linux with foundational knowledge to navigate the terminal and basic file system.

Uploaded by

zakagi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

The Linux Survival Guide

This document provides an overview of basic Linux terminal commands and directory structure for beginners. It introduces common commands like ls, cd, mv, cp, rm, and cat. It explains the Linux directory structure including important directories like /bin, /sbin, /etc, /usr, /home, /opt, /tmp, and /var. It also discusses users and permissions, explaining where user information is stored in files like /etc/passwd and the encrypted passwords in /etc/shadow. The goal is to provide newcomers to Linux with foundational knowledge to navigate the terminal and basic file system.

Uploaded by

zakagi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

The Linux Survival Guide

The Terminal

Objectives
WTF is a terminal? Why cant I use a GUI? Babys first filesystem command The Linux directory structure (and why you shouldnt delete it) Usernames and passwords and shadows Oh My!

BASH

~SyMbOlS~
Every bash prompt is different (since you can customize it a lot) Typically, the first thing that it shows you is who you are logged in as and what your hostname is Then, it shows you what directory you are in ~ is shorthand for your home directory (think C:\Users\MyName) A $ or a : usually marks the end of the prompt (stuff you type in goes after this symbol)

No GUI, no problems
While many of the GUI utilities on Linux are now very mature and useable, its a very good idea to get used to not using it You wont have it in the finals and if you are running a server environment (which will be most of the time) you will uninstall it Also, many things are simply not able to be done in the GUI

A Great Adventure
It would be helpful if you had some sort of Unix command shell to run these commands on. You have a few options: If you are on Linux or Mac, youre set. If you are on Windows, you can either get a VM or install MSYS or Cygwin If we are short on time, dont worry about installing these things, practice can wait.

A note on commands
Typically, unix commands run in the form of command [flags] file

Note that [] denotes optional things


There are 3 kinds of flags that Linux uses: Unix style: -f BSD style: f Or GNU long style --flag

ls List files
Lists the files in a folder When called without a file argument lists the contents of your current folder When called with a file argument, shows the contents of that folder With no flags, only shows the names of files and folders in the directory Linux uses forward slashes (/) instead of backslashes (\) like windows does. The topmost directory (like the C:\ drive) is /

ls flags
-l: Long format. Lists useful information like size, permissions, and date modified -h: When used in conjunction with l makes the sizes human readable -a: list hidden files Hidden files in Linux have the first character of there names as a period (dotfiles) You can combine the flags, ex: ls -la /home/brian

ls lh

mv Move files
mv file1 file2 moves file1 to file2 Can contain directories or not, this is how you rename files You can move directories too

cp - copy
cp file1 file2 Copies a file Use the r flag to copy directories

cd change directory
Changes your current directory cd directory No flags of note, but you can use cd ../ to back up one directory

rm remove file
rm file Can be used to remove directories with the rf option Be very careful with this. There is no recycle bin in Linux, everything is just instantly deleted

cat view the output of a file


cat file Prints the contents of a file to the terminal

Files, everywhere
One other thing that seperates Linux from windows is that everything is represented by a file

Including hardware, for example /dev/ps2 represents your mouse


There is no registry in linux, all configuration is done through editing configuration files.

A tour
Now that we know some very basic commands, lets go through some of the directories that make up the Linux system

As preface, let it be known that there is no equivalent to C:\Program Files on Linux. Files for a program are scattered throughout the file system separated by the type of file they are The package manager keeps track of all this
If you delete any of these directories, youre gonna have a bad time

/bin
Contains essential binaries that are needed for your system to boot: stuff like ls, cp, gcc, and bash

/sbin
Shared binaries Typically used to store binaries used for system administration, like lsof and ifconfig On some distros, normal users dont have access to this

/etc
The configuration directory Contains system wide config files (individual users can sometimes override these) Lots of work to be done here

/usr
Contains userspace binaries, like your GUI These programs are not strictly required for your computer to boot, and are thus contained differently than /bin

/dev
Contains information about your computers hardware

Remember, your hardware has a file representation (and its located here!)

/home
Home sweet home Somewhat like C:\Users All the users (except for root) files are stored here Roots files are contained in a separate directory called /root Each user can only read there own files

/opt
Optional programs Not often used, but sometimes programs will hide stuff in here that you might have to get rid of

/tmp
Temporary files Wiped every so often, dont store things here

/var
Contains variable content: stuff like logs If you are running a web server, the web pages will be stored here (usually something like /var/www)

/proc
Contains information about currently running processes

Is a pseudo-filesystem, meaning that it doesnt actually write anything to the disk, all information is kept in the RAM

/sys
Contains information about plug n play devices Another pseudo file system

/boot
Contains the information your computer needs to boot

If you delete this you are extra screwed

Lets Get Down to Business


To configure some users! A list of users is kept in the /etc/passwd file This file also has some other information about the users, including user id, default shell, and home directory

Readable by everyone
Doesnt have passwords in it

User IDs
User ID 0 is root. He is the administrator Multiple accounts can have user id 0, and if a non root user has uid 0 he has root privileges! Regular users uids start at 1000 Anything between 0 and 1000 is a system user

Afraid of shadows
Users passwords are stored in the /etc/shadow file This file is encrypted and not visible to other users If it is visible to users, then you have a problem

fin
That concludes this wonderful powerpoint I hope you enjoyed your stay I should stop writing powerpoints at 1am I should get some more coffee

You might also like