Linux

Linux is Unix-like computer operating system using the Linux kernel and is a free and open source software collaboration.

Security is a feature of the core system, the kernel has a firewall, with a firewall at the heart of the kernel a Linux computer can more efficiently run your programs.

[find]

> find . -name lostfile -print
start in the current dir (.) -name option makes the search case sensitive, find lostfile, print onscreen

[sed]

sed is a stream editor, like search and replace.
sed does not change the input file, you must save output as another file.
s substitue
g make a global change, replace all instances of pattern
>sed 's/pattern/replacement/g' file.php > outputfile.php
>sed 's/dog/cat/g' file.php (replace dog with cat)

d delete
> sed 'start,end' file.php
> sed '2,3d' file.php (deletes line 2 and including all of line 3)

Linux dev center

resource directory of Linux commands from Linux in a Nutshell

PuTTY SSH

PuTTY is a client program for the SSH network protocol, and if you're stuck on Windows then it's a way to connect to a hosted Linux server over network.

Linux

Linux is the operating system powering everything from mobile phones to supercomputers to personal devices.

In a command line interface (CLI) you type commands with your keyboard, rather than using a mouse in a GUI.

[cmd]

.		this dir
..		move up 1 level, go to the parent dir
cd		change dir
cd /design	go to design, absolute pathname starts from the root dir
ls		list the contents of a dir
ls -l		list long, show additional info
ls -a		list all, including hidden files
ls design	list all files in this dir
ls ./design	same as above, dot refers to the working dir
ls /abc/design	list all files in this dir, absolute path from the root dir
ls | spell	list pipe spellcheck
/foo		search for pattern foo
pwd		print working dir

cp abc abc.bak		copy file named abc to abc.bak in the same dir
cp -i file file2	copy with interactive -i option, you will be prompted before overwriting file2.
cp file dir1		copy file into directory.
cp file dir1/file2	copy file into directory but under a new name.
cp -r dir1 dir2		copy recursively

mv file file2		move or rename
mv file dir1		move file into another directory
mv dir1 dir2		renaming dir1 to dir2

mkdir dir1		make dir named dir1
rmdir dir1		remove dir named dir1

rm file			remove
rm file file2 file3	remove many
rm ./foo		removes any file with foo
rm \'			kills the apostrophe file

rm -r dir1		removes contents recursively -r option.
rm -ir dir1		rm interactive

$rm *[!cehg]		deletes all that do not end with c,e,h,g

[vi]

yy		copy
p		paste
dd		delete
dw		delete word
D		delete to end of line
u		undo last change
U		undo all changes to entire line
Ctrl C		command out clear, to get out of (>)
:0		home (zero)
:$		end
grep "redeem" /home/dir/*.php search for string in dir (any .php file)

[more]

cat view_this		cat displays the contents of a text file, exit Ctrl+D
less view_this		less displays the file, and automatically paginates it (use PageUp PageDown, q for quit)

h,j,k,l			left, down, up, right or use the arrow keys
e, j, Down, or Enter 	move forward one line
y, k, or Up 		move backward one line
f, Space, or Page Down 	move forward one page
b, or Page Up 		move backward one page
/characters 		search forward in the file for lines containing the specified characters
n 			repeat the previous search
:e file_name 		examine a new file
:n 			examine the next file
:p 			examine the previous file
h, or ? 		display help
q 			quit

[wildcard]

*			zero or more characters
?			exactly 1 char
[abcde]			exactly one character listed
[a-e]			exactly one character in the given range
[!abcde] 		any character that is not listed
[!a-e] 			any character that is not in the given range
{debian,linux} 		exactly one entire word in the options given


moves all the HTML files, that have the word "linux" in their names, from the working directory into a directory named dir1:
$ mv *linux*.html dir1

displays all files that begin with d and end with .txt:
$ less d*.txt

The following command removes all files whose names begin with junk., followed by exactly three characters:
$ rm junk.???

With this command you list all files or directories whose names begin with hda, followed by exactly one numeral:
$ ls hda[0-9]

This lists all files or directories beginning with hda, followed by exactly two numerals:
$ ls hda[0-9][0-9]

The following lists all files or directories whose name starts with either hd or sd, followed by any single character between a and c:
$ ls {hd,sd}[a-c]

This command copies all files, that begin with an uppercase letter, to directory dir2:
$ cp [A-Z]* dir2

This deletes all files that don't end with c, e, h or g:
$ rm *[!cehg]

[man]

man password	manual help for password
spacebar	nextscreen
b		back
q		quit