This introduction will be a brief intro on how to use Linux. Linux is an operating system that powers many devices that range from webservers to cell phones.
In Linux the file system is structred as shown
/
: Root of the file system
/etc
: Contains system wide configurations
/usr
: Contains system installed files such as programs like vim
/var
: Contains variable data such as logs
/home
: Contains user directories
Knowing how to navigate around the Linux filesystem is a basic but critical skill.
The following are a couple of critical commands for navigating around.
ls
cd
pwd
This command will allow you to list all files and directories in your current working directory
This command will allow you to change your directory
This command will return what your current working directory is
ps
top
kill
This will list processes that are running
Running ps -u $user
will allow you to see what process belong to a certain user
This will list the process tree for the entire OS
Does exactly as the name implies and kills a process
kill $(pidof $process_name)
will kill an instance of $process_name
.
ifconfig
lspci
lscpu
lsmod
uname
w
cat /etc/*releases
Displays and allows control of network interfaces
This will list pci devices
This will list cpu info
This will list kernel modules
This will list a variety of system info ie kernel version
This will list who is logged in
Specific distribution will be displayed
vim
less
cat
tail
rm
mkdir
touch
Text editor
Lets you read through text with vim controls
Allows you to concactenate and print files
Lets you see the newest lines appened to a file
tail -f
allows you to follow a file in real time
Removes files
rm -rf
will recursively force remove which while useful can also accidently destroy alot of work. Use with care
Lets you create directories
Allows you to either create a new file or change an existing files timestamp
ssh user@hostname
grep
tmux
awk
sed
ping
netstat
scp
Lets you search through files or strings piped into it
ls | grep -i myhw
will search the output of ls and try to find 'myhw'
Allows you to split your terminal into multiple sessions from a single session
Lets you sort and print strings
awk '{print $1}' FILE
Will print the first coloumn from a file
Lets you edit strings
sed -i s/stringtoreplace/stringreplacewith/g
Allows you to ping other devices
Gives you info on network interfaces and very useful in seeing what ports are open
Lets you transfer files
If you don't know the arguments or how to use a command just read the man pages
man ls
will display the arguments and some info on the ls
command