Tags

,

#To check the running process:
#netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
netstat -tap
top - display top CPU processes

vi (aka vim) tutorial, tips, tricks and useful commands
Where grep came from (RE being Regular Expression):
:g/RE/p

#Delete lines 10 to 20 inclusive:
:10,20d

#or with marks a and b:
:'a,'bd

#Delete lines that contain pattern:
:g/pattern/d

#Delete all empty lines:
:g/^$/d

#Delete lines in range that contain pattern:
:20,30/pattern/d

#or with marks a and b:
:'a,'b/pattern/d

#Substitute all lines for first occurance of pattern:
:%s/pattern/new/
:1,$s/pattern/new/

#Substitute all lines for pattern globally (more than once on the line):
:%s/pattern/new/g
:1,$s/pattern/new/g

#Find all lines containing pattern and then append -new to the end of each line:
:%s/(.*pattern.*)/1-new/g

#Substitute range:
:20,30s/pattern/new/g

#with marks a and b:
:'a,'bs/pattern/new/g

#Swap two patterns on a line:
:s/(pattern1)(pattern2)/21/

#Capitalize the first lowercase character on a line:
:s/([a-z])/u1/

#more concisely:
:s/[a-z]/u&/

#Capitalize all lowercase characters on a line:
:s/([a-z])/u1/g

#more concisely:
:s/[a-z]/u&/g

#Capitalize all characters on a line:
:s/(.*)/U1E/

#Capitalize the first character of all words on a line:
:s/<[a-z]/u&/g

#Uncapitalize the first character of all words on a line:
:s/ /dev/null 2> /dev/null

#Now just run:  shell> 2html.sh foo.py
# change the ownership of the folder 
# $ sudo chown -R yourusername:nameofthegroup folder
$ sudo chown -R arman:root /var/www/

Document originally from http://www.cs.ualberta.ca/~luca/tricks.vim.html

updated and maintained by Greg Lawler

Advertisements