Files and folders:
Linux is case sensitive.
vim ../somefile = edit file one below current path.
vim ~/john = starts editing file john at home directory.
cp somefile .. = copies the file down one directory.
cp -p = copies owners and permissions as well.
cd - = go to latest directory.
mv = rename.
mkdir -p folderone/foldertwo
mkdir -p some/dir = creates directories with force.
rm -rf somedir = removes directory
rm somefile = removes a link.
mount = connect to a directory on the file system.

slocate = searches for a file on the local system.
find / -name "hosts*"
find -amin 5 = shows files accessed in the last 5 mins.
find -executable = finds executable files.
find / -size +2G = finds files larger than 2gigs. K/M/G
find -type d/r.
find / -user linda -size +100M = find all files owned by linda and are larger than 100mb.

stat somefile = gives information about when a file was accessed and changed.
file sunset.jpg gives information about the file.
wc somefile = lines, words, characters.
df -h #shows information about tmpfs
du -hs /pathtofolder/ = size of folder
ls:
-l = more accurate.
-S = sort by file size.
-t = sort by modification time.
-a displays hidden files as well.
-F makes executables and folders stand out.
ls -(orxa)
ls -ld */ = list only directories.
.. = shows directories siblings.
-ld */ = shows only directories
--sort=size = sort by file size.
--time=-word- = sort by time in some way.
|more = stops after each screen fill.

a symbolic link refers to the name of a file.
ln -s /etc/hosts ~/computers
a symbolic link is like a shortcut. it breaks if you remove the original file.
a hard link points to the same inodes as the original file. its just like the same file.

#################################################
File access:
permissionfilesdirectories
read open a filelist contents
writechange contentscreate and delete files
executerun a program filecd to
read,write,execute=1,2,4.
chmod g+w, o-r somefile = adds write to group, removes read from others.

chmod +x script.sh
And then to run it..
./script.sh

#################################################
Processes:
pstree = shows process tree.
ps -ax = see all processes running in the system.
ps -aux or ps -ex = shows processes and their states.
top = shows processes sorted by how active they are. shift-F allows to edit columns.
processes can start threads, threads eat up less resources.
fg = put it in the foreground.
bg = put program into background.
only fg jobs can receive input from the keyboard.
lsof pathfile = gives info on processes using a given pathfile.

ctrl-z = pause running program.
ctrl-c = stop program.

kill %1
kill -KILL %1

crond checks /etc/crontab every minute.
crontab -e

#################################################
Users:
which = where is program.
whereis = where are files related to.
finger = gives information regardings users of this system.
hostname = displays the hosts name.
w/users/who = gives information about users currently logged in.
who am i
write somename = write to that user.
if john is logged in i can type "write john sometext"
wall = write all.
passwd = change password.

#################################################
Shells:
bash = goes into a subshell.
export HAPPY=yes makes that variable available in all children shells.
ssh -t user@domain "cd public_html/; bash;"
# indicates youre root.
-- = long option.
2> = redirects error messages only.
/dev/null = the black hole.

#################################################
Convert:
pdf to jpg: convert 1.pdf 1.jpg
jpg to pdf: convert 1-0.jpg 1-1.jpg -adjoin hemmi.pdf

#################################################
Zip:
to unzip: unzip "[1-3].zip"
to zip: zip -9 -r zip_name folder_name

Tar:
c=create archive, x = extract archive. t = list contents of archive. v = verbose. z = compress. j = compress more, at high cpu cost.
tar does not automatically compress.
-C before target folder makes filenames relative. thats a good thing.
tar -czvf home.tar.gz /home
tar -xzvf /file.tar.gz C /somedir.
tar -xvf /file.tar C /somedir.
create a snapshot file:
tar -czvg /backup/snapshot-file -f /backup/full-backup.tar.gz /home

#################################################
System information:
/etc/ = global files
/dev = devices
/etc = configuration
/proc= hardware stats

~/.bash_history
uname -r = kernel type.
uname -p = cpu type
cat /etc/*release = linux version

#################################################
XAMPP:
Start
#after downloading and unpacking the linux version from XAMPP server here.
#turn into superuser: su
#if apache and mysql daemons are already running they need to be killed first:
ps -A
killall apache2
killall mysqld
/opt/lampp/lampp start
I got error when trying to connect to the database after this,
the solution was: ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock
now i can connect.

#################################################
Installation:
sudo apt-get install libdevel-ptkdb-perl
sudo apt-get install libfile-slurp-perl
sudo apt-get install perlmagick
sudo apt-get install libgd-graph3d-perl

apt-cache search -keyword-

#################################################
Other:
script = starts recording.
mail -s "this is the text" hermanningjaldsson@gmail.com < .