Linux 101
What we're going to cover
- Linux filesystem
- Basic terminal/shell usage
- Cron jobs
- Additional/helpful resources
Linux filesystem
- Think hierarchy
- No concept of c/d drives, think mount points
- EVERYTHING IS A FILE
- The tilde "~" character is a shortcut for the reference to your home folder
Loose standard for "what goes where": http://www.pathname.com/fhs/pub/fhs-2.3.pdf
Linux shell
Know it
LOVE IT
UsE IT
everything in linux can be accomplished via shell
we have Desktop environments, why use the shell?
- Exposes you to the internals of how things work in Linux
- If you can run it in the shell, you can automate it
- 99% of Linux servers WON'T HAVE A DESKTOP ENVIRONMENT if setup correctly
LS/find
- "ls" is the same as "dir" in Windows
- "find" basically does a recursive "ls" + more
ex. List all files, including hidden files, in current folder
ls -la
cd
Filesystem navigation/basic manipulation
cp/MV/rm/mkdir
Copy/move/remove files
No "rename" in Linux, use "mv"
rm -rf # recursively remove files mkdir -p ~/projects/new_project mv jeo.txt joe.txt # rename file cp ~/.ssh/known_hosts ~/hosts.bak
cat/touch
"Concatenate" == echo file content to standard out (stdout)
http://www.tecmint.com/13-basic-cat-command-examples-in-linux/
"Touch" == create empty file or update last-modified file date/time
less/more
- Pause output at page boundaries
- "less" is more versatile
pipes and redirection
A pipe "pipes" the output from one command into the input of another command
cat joe.txt | sort
streams => STDIN/STDOUT/STDERR
echo "Hi, there!" > joe.txt
streams
ps
ps -aux | grep PROC
^ list all processes and filter down to process that contain "PROC" in their listing
kill and signals
- Sends a signal to a process
- Signal 9 == forcefully kill the process via kernel
- Sends TERM (stop) to process by default, if process is hung it might not actually self-terminate
kill -9 PROCESSNUMBER
^ process with PROCESSNUMBER is now dead for sure
processes
killall
-
killall firefox # processes named firefox sent TERM signal
-
killall -9 firefox # tell kernel to kill all firefox processes
cron jobs
"run something on a schedule"
The Windows task scheduler, Linux style
resources
- Man pages
-
man ls
-
- Tutorials
Linux 101
By Joe Meilinger
Linux 101
- 269