VI Commands:

Code Library, Linux Apache Server No Comments »

VI is like a text editor for linux command line, SSH, telnet etc not unlike notepad for windows.

VI Commands:

i                            insert mode, (ESC to exit insert mode) allows text to be entered on the screen
a                           Append to right mode
/word                  Move to the occurrence of “word”
n                           Locate the next occurance
w                          Advance to the next word
e                           Advance to the next end of a word
b                          Move to the previous word
3b                        Move backward 3 words
dd                        delete line
3dd                      delete 3 lines
D                          Delete remainder of a line
dw                        Delete word
x                          Delete character
o                          Open space for new line below the cursor line
O                         Open a line above the cursor
CTRL-w             Move back a word in append mode
u                          Undo last
U                         Undo all changes to current line
.                           In command mode, repeat the last text changing the command on the current line
:w newfilename        save the file to newfilename from the command mode
:wq                      save and quit
:q!                       quit without saving
r                          replace then typa a character ot be replaced with r then return to break up a line
J                          join 2 lines
s                          substitute (sentence) typed text over a character, ESC when done
cw                       change word
c                          change part of a line from the cursor to the end of the line
cc                        substitute new text for aline, ESC when done
h                          move the cursor back one space
H                          move the cursor to the highest line on the screen
L                          move the cursor to the lowest line on the screen
M                         position the cursor at the midpoint on the screen
G                          last line in the file
0 (zero)               Move the cursor to the beginning of the line it is on
view filename     Open a file for viewing only
set number         Turn on line numbers
set nonumber     Turn off line numbers

Options:

number
autoindent (ai)                 ctrl-d to move to the left
showmatch                       match brackets and parenthesis
tabstop=4
wrapmargine(wm)         when line is wrapped (80-value)
:2 copy 4                          Place a copy of line 2 after line 4.
:1,4                                    copy 7 (lines 1-4)
:n                                       Access the next file for editing

Rate This Post:

SSH Commands

Code Library, Linux Apache Server No Comments »

Common SSH Commands

passwd : Change your SSH account’s password, options follow after typing to change account password.

nano [option] [file]: friendly, easy to use file editor
nano –w /home/aquhome/public_html/index.php : your now editing index.php with –w being non wrapping of long lines

mkdir [directory_name] : Make a directory with proper default permissions
mkdir aquhome : Makes the directory aquhome in what ever directory your currently in

df : [attribute]
df -h[B] : will show how much disk space is available in human readable format (Megabytes and Gigabytes!)
cd : change directory
cd ~ : go to your home directory
cd – : go to the last directory you was viewing
cd ../ : go up a directory
cd [directory path]
cd /home/aqhome/public_html

ls: lists files & directories in a directory
ls –l : shows all files with detailed attributes

vi : an advanced editor, tons of features, but much harder to use then nano
vi /home/aquhome/public_html/index.php : now we’re editing that index.php file again!

ln : creates sys links between files and directories
ln –s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : Now you can edit the /etc/httpd.conf rather than the original, changes will effect the original instantly, however you can delete the link without deleting the original.

wall : broadcast message
wall [message]
wall so whens the server being restarted?

top : shows continuously updating system processes in a table.

w : shows who is currently logged in and there ip address.

ps : displays processes running. It’s similar to the top command, and it’s used to show currently running processes and their PID.

touch : creates a empty file.
touch [file]
touch index.html : creates a empty index.html

kill : terminate a system process
kill -9 [PID] : You can get a PID by using Top.
kill -9 100545

cp : copy a file
cp yourfile yourfile.copy : copies yourfile to yourfile.copy
cp –a /home/aquhome/public_html/* /home/aquhome/public_ftp/ : copies all of the files in public_html to /public_ftp

du : shows disk usage
du –sh : shows a summary, in human-readable form, of total disk space used in the currently directory, including subdirectories

netstat : shows all current network connections
netstat -rn : shows routing tables for ip’s.
netstat -an : shows all connections to the server.

chown : commands for system that changes the owner of a file
chown [attribute] newowner.newowner filenames
chown -R aquhome.aquhome /home/aquhome/public_html/index.php

chmod : [-r] permissions filenames
Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
CHMOD 755 /home/aquhome/public_html/index.php

last : displays last logins to the system
last

rm : delete a file
rm filename.txt : deletes filename.txt, will more than likely ask if you really want to delete it
rm -f filename.txt : deletes filename.txt, will not ask for confirmation before deleting.
rm -rf tmp/ : recursively deletes the directory tmp, and all files in it, including subdirectories. BE VERY CAREFULL WITH THIS COMMAND!!

grep : looks for patterns in files
grep root /etc/passwd : shows all matches of root in /etc/passwd
grep -v root /etc/passwd : shows all lines that do not match root
wc : word count
wc -l filename.txt : tells how many lines are in filename.txt

mv : Moves a file.
mv -f /home/pen/ram.php /root/ Moves ram.php to the directory root

Basic Extracting

tar xvfz imagick-0.9.11.tgz (extracts the .tgz file)

bzip2 and bunzip: Files With .bz2 Extensions

bzip2 filename.txt : zips filename.txt to filename.txt.bz2

bunzip2 filename.txt.bz2 : unzips filename.txt.bz2 to filename.txt

[B]Important Service Commands

Restart apache:
-
service httpd restart

Restart MySQL:
-
service mysql restart

Restart exim:
-
service exim restart

Restart Cpanel:
-
service cpanel restart

Note: “restart” can be replaced with “stop” to quit the service and “start” to start a stopped service.

Restart apache:
service httpd restart
Restart MySQL:
service mysql restart
Restart exim:
service exim restart
Restart Cpanel:
service cpanel restart

Rate This Post:

Hello and welcome to my website

Personal No Comments »

Just some thoughts about the UK and world and what we need to do in order to save mankind’s liberties.
“We have to end apartheid and slow down the nuclear arms race, stop terrorism and world hunger. Ensure a strong national defence, prevent the spread of violence within central urban areas, work on the middle east settlement, prevent UK military involvement overseas. We have to ensure that the UK is respected as one of the world’s economic leaders. Now that’s not to belittle our domestic problems, which are equally important, if not more. Better and more affordable long -term care for the elderly , control and find the cure for the AIDS epidemic, clean up environmental damage from toxic waste and pollution, improve the quality of primary and secondary education, strengthen laws to crack down on crime and illegal drugs. We also have to ensure university education is affordable to everyone and protect the NHS for everyone plus conserve natural resources and areas of nature beauty and reduce the influence of political action committees.”
“But economically we’re still a mess. We have to find a way to hold down the inflation rate and reduce the national debt. We also need to provide training and jobs for the unemployed as well as protecting existing UK jobs from unfair foreign imports. We have to make England and the rest of the UK a leader in new technology and at the same time preserve our historical companies. We need to promote economic growth and business expansion and hold the line against income tax and hold down interest rates while promoting opportunities for small businesses and control mergers and big corporate takeovers.”

“We cannot ignore our social needs either. We have to stop people for abusing our welfare system, while still providing food and shelter for the homeless. We need to oppose racial discrimination and promote civil rights while also promoting equal rights for women but change abortion laws to protect the right to life yet still maintain women’s freedom of choice. We have to control the influx of illegal immigrants. We have to encourage a return to traditional moral values and curb graphic sex and violence on TV, in the movies, in popular music, everywhere, but allow freedom of choice to those above a consenting age. Most importantly we have to promote general social concerns and less materialism in young people.”

I could go on but I’m sure you’ve stop reading by now. Anyway I give you …my website!©

Rate This Post:
Entries RSS Comments RSS