Introduction
GNU.org
Commands QUICK List
PICO, VI, VIM, NANO
Editors
sudo –s
launch a shell with sudo
SHIFT-CTRL-C
COPY
SHIFT-CTRL-V
PASTE
CTRL-A
Start of the line
CTRL-E
End of the line
CD
Change Directory
~
HOME
TOUCH
Update file timestamp
RM –RF
Remove –r(recursive)….NOT SURE ON THE F
MKDIR
Create directory
FIND files
-name case sensitive
-iname case insensitive
FIND /startdir -name \*.log
LS directory
-l list LONG version
-al all files
-ali all files, all information
-A all files, brief
Df
Disk free space
-h Human readable
PAGE/LESS
Print entire text file to screen
CAT
Print entire file contents to StdOut
HEAD –n 5
print FIRST 5 lines of a file
TAIL –n 5
print LAST 5 lines of a file
WC
count lines, words, characters
GREP
<COMMAND> | GREP <STRING> =Filter
WHICH test
Location of an executable
ADDUSER
–m –p test test
-m =create home directory
-p =password
USERNAME goes LAST
USERDEL
Delete User
PASSWD
Add/change password to current user
Processes
ps –ax
list processes
top
dynamic list of running processes
CUT Chops tabulated data by column and delimiter
LET INCREMENT VARIABLE (let "COUNT += 1")
^C = interrupting a loop
Pico
^O save
^K cut line
^U Paste line
Alt-\ Top
Alt-/ Bottom
Terminal
C-S-‘T’ = new TAB
Basics
Shell Prompts
# - normal login
$ - root login (su or sudo)
- root user always has USERID=0
CD
- returns to user’s HOME directory
EXIT
- returns user to root directory and releases the ‘su’ root access rights
PAGE & LESS
- Pagers to view text files
- CTRL-Z to exit
etc/profile
- global configuration
- size of history
- user prompts
- environment variables
- user settings
etc/bash.rc
- aliases and functions
- logic for logged in the user
- aliases
- correspond to a certain name with command and arguments
- Ex.: less = ls –l
- functions: shell could determine blocks of code
- $PS1 variable control prompt
- Ex.:[\u@\\h \W]\\$
Hidden Files
- files preceded with ‘.’ are hidden by default
etc/skel (SKELETON)
- ls –al = list all
- skel contains all hidden files
- upon login bash reads all
The location of /etc/skel can be changed by editing the line that begins with SKEL= in the configuration file /etc/default/useradd. By default this line says SKEL=/etc/skel.
.bash_logout
- routines for logging out
.bash_profile
- user specific settings and functions
.bashrc
- personal functions and aliases on a per-user basis
.bash_logout
- executes upon logout
- simply clears screen by default\
Explanations
bash_profile
- if exists [ etc/.bashrc ], then run it..
- ~/.bash_profile
- ~/.bashrc
- PATH=$PATH:$HOME/bin
- /etc/profile assigns $HOME
- export PATH
- write $PATH variable to the $PATH environment variable
- unset USERNAME
- release USERNAME variable
bashrc
- if exists /etc/bashrc, run it
Files Readupon logon
System-wide
- impacts already existing users
etc/profile
- PATH
- Variables
etc/bashrc
- functions and aliases
Per User (if exists..)
only new users when added
~/.bash_profile
~/.bashrc
Creating a new user
when creating new user… etc/skel contents are copied to user $HOME directory
- system files copied
- user files copied
setup@ubuntu-vm1:/home$ sudo useradd -m -p test test
setup@ubuntu-vm1:/home$ cd test
setup@ubuntu-vm1:/home/test$ ls -al
total 32
drwxr-xr-x 2 test test 4096 Apr 2 02:38 .
drwxr-xr-x 5 root root 4096 Apr 2 02:38 ..
-rw-r--r-- 1 test test 220 Sep 19 2012 .bash_logout
-rw-r--r-- 1 test test 3637 Sep 19 2012 .bashrc
-rw-r--r-- 1 test test 8445 Apr 16 2012 examples.desktop
-rw-r--r-- 1 test test 675 Sep 19 2012 .profile
setup@ubuntu-vm1:/home/test$
Scope vs Location
- /etc is for SYSTEM
- /etc/skel is for USER
User settings can override or append global settings
- global
- local
- new users
Note: CLOSEST SCOPE overrides previous scope’s settings
Setting Variables in these user profiles will cause updates for FUTURE logons
Command History
Setting up SSH(Port 20)
The openssh-server doesn’t seem to be installed by default so…install it.
ssh –l test localhost
sudo service ssh start
sudo service ssh stop
sudo apt-get remove openssh-server
setup@ubuntu-vm1:~$ apt-cache policy openssh-server
openssh-server:
Installed: (none)
Candidate: 1:6.0p1-3ubuntu1
Version table:
1:6.0p1-3ubuntu1 0
500 http://us.archive.ubuntu.com/ubuntu/ quantal/main i386 Packages
setup@ubuntu-vm1:~$ sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
ncurses-term ssh-import-id
Suggested packages:
rssh molly-guard openssh-blacklist openssh-blacklist-extra monkeysphere
The following NEW packages will be installed:
ncurses-term openssh-server ssh-import-id
0 upgraded, 3 newly installed, 0 to remove and 324 not upgraded.
Need to get 775 kB of archives.
After this operation, 3,066 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Verify Installation and Status
setup@ubuntu-vm1:/home/test$ apt-cache policy openssh-server
openssh-server:
Installed: 1:6.0p1-3ubuntu1
Candidate: 1:6.0p1-3ubuntu1
Version table:
*** 1:6.0p1-3ubuntu1 0
500 http://us.archive.ubuntu.com/ubuntu/ quantal/main i386 Packages
100 /var/lib/dpkg/status
setup@ubuntu-vm1:/home/test$ sudo service ssh status
ssh start/running, process 5290
setup@ubuntu-vm1:/home/test$ addpasswd
The program 'addpasswd' is currently not installed. You can install it by typing:
sudo apt-get install gnugk
setup@ubuntu-vm1:/home/test$ sudo apt-get install gnugk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libh323-1.24.0 libodbc1 libpt2.10.4 libsdl1.2debian
Suggested packages:
ekiga ohphone ohphone-basic simph323 libmyodbc odbc-postgresql tdsodbc
unixodbc-bin
The following NEW packages will be installed:
gnugk libh323-1.24.0 libodbc1 libpt2.10.4 libsdl1.2debian
0 upgraded, 5 newly installed, 0 to remove and 324 not upgraded.
Need to get 5,561 kB of archives.
After this operation, 16.1 MB of additional disk space will be used.
setup@ubuntu-vm1:/home/test$ passwd test
passwd: You may not view or modify password information for test.
setup@ubuntu-vm1:/home/test$ sudo passwd test
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
SET
SET alone will print ALL variables
$ set
CLASSPATH='/usr/java/jdk6'
HOME='/home/test'
IFS='
'
JAVA_BIN='/usr/java/jdk6/bin'
JAVA_HOME='/usr/java/jdk6'
JAVA_JDK='/usr/java/jdk6'
JRE_PATH='xxxxxxxxxxxx'
LANCE='ReallyCool'
LANG='en_US.UTF-8'
LOGNAME='test'
MAIL='/var/mail/test'
OPTIND='1'
PATH='/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/java/jdk6:/usr/java/jdk6/bin'
PPID='6173'
PS1='$ '
PS2='> '
PS4='+ '
PWD='/home/test'
SHELL='/bin/sh'
SSH_CLIENT='127.0.0.1 38878 22'
SSH_CONNECTION='127.0.0.1 38878 127.0.0.1 22'
SSH_TTY='/dev/pts/1'
TERM='xterm'
USER='test'
XDG_RUNTIME_DIR='/run/user/test'
XDG_SESSION_COOKIE='bb979e30f8215ca13b13321551551a88-1364891226.907362-87009971'
_='ReallyCool'
SET | GREP <STRING> will filter by the string
$ set | grep JAVA
JAVA_BIN='/usr/java/jdk6/bin'
JAVA_HOME='/usr/java/jdk6'
JAVA_JDK='/usr/java/jdk6'
PRINTENV
MAIL=/var/mail/test
USER=test
SSH_CLIENT=127.0.0.1 38878 22
HOME=/home/test
SSH_TTY=/dev/pts/1
XDG_SESSION_COOKIE=bb979e30f8215ca13b13321551551a88-1364891226.907362-87009971
LANCE=ReallyCool
JRE_PATH=xxxxxxxxxxxx
LOGNAME=test
TERM=xterm
PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/java/jdk6:/usr/java/jdk6/bin
XDG_RUNTIME_DIR=/run/user/test
LANG=en_US.UTF-8
SHELL=/bin/sh
JAVA_JDK=/usr/java/jdk6
JAVA_BIN=/usr/java/jdk6/bin
CLASSPATH=/usr/java/jdk6
PWD=/home/test
JAVA_HOME=/usr/java/jdk6
SSH_CONNECTION=127.0.0.1 38878 127.0.0.1 22
Echo <variable>
$ echo $LANCE
ReallyCool
TEST
man test
- Each command performed in the console will return an error code to ‘?’ variable
- Can test against ?
- use WHICH to locate where test executable is
setup@ubuntu-vm1:/etc$ which test
/usr/bin/test
Operators: Testing Integers
-eq, -ne, -le, -ge, -lt , –gt,
Operators: Testing Strings
test hello_world = hello_worl; echo $?
= equal
!= not equal
-nt newer than
-ot older than
Testing Devices
Character Devices, not normal block devices
/dev/cua0 – COM1
/dev/cua1 – COM2
Used to verify you are working with a block or character device before writing to it
-b block device (modem-/dev/cua0)
-c serial device
Other Tests
-e exists (file or dir)
-f regular file (not a dir)
-l
-n
setup@ubuntu-vm1:/etc$ which test
/usr/bin/test
setup@ubuntu-vm1:/etc/skel$ test 1 -eq 1
setup@ubuntu-vm1:/etc/skel$ test 1 -eq 1
setup@ubuntu-vm1:/etc/skel$ echo $?
0
setup@ubuntu-vm1:/etc/skel$ test 100 -eq 200
setup@ubuntu-vm1:/etc/skel$ echo $?
1
setup@ubuntu-vm1:/etc/skel$ test 100 -lt 200
setup@ubuntu-vm1:/etc/skel$ echo $?
0
setup@ubuntu-vm1:/etc/skel$ test 100 -gt 200
setup@ubuntu-vm1:/etc/skel$ echo $?
1
String Tests
setup@ubuntu-vm1:/temp2$ sudo touch testing1
setup@ubuntu-vm1:/temp2$ sudo touch testing2
setup@ubuntu-vm1:/temp2$ test testing1 -nt testing2; echo $?
1
setup@ubuntu-vm1:/temp2$ test testing1 -ot testing2; echo $?
0
in scripts test won’t be used, instead [ -f <filename> ]
-S socket test ( /.var/lib/mysql.sock is a socket)
-s zero byte files ( create new empty file to pass test)
Bash Commands
standard linux command list is not extensive, so shell scripts are created and included in the distribution as utilities
cat operate from beginning of a file
tac operate from end of file
-A show all (ex.: EOL shows as $ (is regex for EOL) )
-T indicate TAB
-E show ends
After creating data1 with 3 text lines…
setup@ubuntu-vm1:/temp2$ sudo pico data1
setup@ubuntu-vm1:/temp2$ cat data1
LinuxCBT
Another Line
Anocat hter Line1
setup@ubuntu-vm1:/temp2$ cat -A -s data1
LinuxCBT$
Another Line$
Anohter Line1$
$
more lines after a blank line$
$
more lines after more lines$
root@ubuntu-vm1:/temp2# cat data1 data1a > data1b
root@ubuntu-vm1:/temp2# cat data1b
LinuxCBT
Another Line
Anohter Line1
more lines after a blank line
more lines after more lines
additional text
file data1a
root@ubuntu-vm1:/temp2# which cat
/bin/cat
root@ubuntu-vm1:/temp2# which tac
/usr/bin/tac
Updating File Timestamp with TOUCH
root@ubuntu-vm1:/temp2# ls -l data1
-rw-r--r-- 1 root root 100 Apr 2 05:06 data1
root@ubuntu-vm1:/temp2# touch data1
root@ubuntu-vm1:/temp2# ls -l data1
-rw-r--r-- 1 root root 100 Apr 2 05:16 data1
wc count lines, words, characters
wc –l count lines only
wc –l | cut –d ‘ ‘ –f 1
cut with –d delimeter
root@ubuntu-vm1:/temp2# wc data1
11 16 100 data1
List all files and find get count
ls –A | wc –l
ls –time=atime –ltr data1 (access time)
-l long listing
-t sort by modification time, newest first
-r reverse order
sleep pause for x seconds
usleep pause for x microseconds ( 1,000,000 = 1 second)
TIME ( Timer )
root@ubuntu-vm1:/temp2# which time
/usr/bin/time
PS ( Pocesses )
ps -aux
Locating process instances
root@ubuntu-vm1:/temp2# ps aux | grep bash
setup 2572 0.0 0.2 6368 2768 pts/0 Ss 01:29 0:00 bash
setup 2873 0.0 0.2 6356 2764 pts/0 S 01:30 0:00 bash
setup 3065 0.0 0.2 6360 2752 pts/0 S 01:33 0:00 bash
setup 3113 0.0 0.2 6360 2768 pts/0 S 01:33 0:00 bash
setup 3278 0.0 0.2 6356 2764 pts/0 S 01:42 0:00 bash
setup 3346 0.0 0.0 4460 844 pts/0 T 01:44 0:00 less bash.bashrc
setup 3827 0.0 0.0 4460 848 pts/0 T 02:17 0:00 less .bash_logout
setup 3849 0.0 0.0 4396 836 pts/0 T 02:19 0:00 grep --color=auto bash
setup 3876 0.0 0.2 6360 2768 pts/0 S+ 02:21 0:00 bash
setup 5341 0.0 0.2 6400 2920 pts/5 Ss 03:08 0:00 bash
root 7083 0.0 0.2 6352 2756 pts/5 S 05:12 0:00 /bin/bash
root 7309 0.0 0.0 4392 832 pts/5 R+ 05:37 0:00 grep --color=auto bash
KILL
kill a process
TOP
picture view of process listing, memory, cpu usage
TAIL
end part of a file
DATE
root@ubuntu-vm1:/temp2# date
Tue Apr 2 05:44:33 CDT 2013
-r show date of last modification to a file
root@ubuntu-vm1:/temp2# date -r data1
Tue Apr 2 05:16:02 CDT 2013
%s seconds
root@ubuntu-vm1:/temp2# date +%s
1364899721
root@ubuntu-vm1:/temp2# date +%s
1364899721
root@ubuntu-vm1:/temp2# date +%d-%T-%b
02-05:50:30-Apr
EXPR (Expression) with Integers
root@ubuntu-vm1:/temp2# which expr
/usr/bin/expr
+, -, \*, /
root@ubuntu-vm1:/temp2# expr 10 + 10
20
root@ubuntu-vm1:/temp2# expr 10 + 100
110
root@ubuntu-vm1:/temp2# expr 10 \* 100
1000
2
root@ubuntu-vm1:/temp2# i=`expr $i + 1`; echo $i
3
root@ubuntu-vm1:/temp2# i=`expr $i + 1`; echo $i
4
EXPR with Strings
root@ubuntu-vm1:/temp2# expr LinuxCBT = LinuxCBT
1
root@ubuntu-vm1:/temp2# expr LinuxCBT = LinuxCBTs
0
root@ubuntu-vm1:/temp2# expr length LinuxCBT
8
root@ubuntu-vm1:/temp2# expr length LinuxCBT
8
root@ubuntu-vm1:/temp2# expr substr LinuxCBT 1 3
Lin
root@ubuntu-vm1:/temp2# expr substr LinuxCBT 2 5
inuxC
root@ubuntu-vm1:/temp2# touch `date +%F`.log
root@ubuntu-vm1:/temp2# ls -ltr
total 12
-rw-r--r-- 1 root root 0 Apr 2 04:27 testing1
-rw-r--r-- 1 root root 0 Apr 2 04:27 testing2
-rw-r--r-- 1 root root 28 Apr 2 05:08 data1a
-rw-r--r-- 1 root root 128 Apr 2 05:13 data1b
-rw-r--r-- 1 root root 0 Apr 2 05:15 data1c
-rw-r--r-- 1 root root 100 Apr 2 05:16 data1
-rw-r--r-- 1 root root 0 Apr 2 06:05 2013-04-02.log
root@ubuntu-vm1:/temp2#
root@ubuntu-vm1:/temp2# echo "Program Succeeded" >> `date +%F`.log
root@ubuntu-vm1:/temp2# cat 2013-04-02.log
Program Succeeded
%s (Time since epoch)
Used to have a common point of reference across systems
%s 1970-01-01 Time since epoch
%N ( nano seconds)
Create a random number by using nanoseconds since it updates so fast
root@ubuntu-vm1:/temp2# date +%N
469884192
root@ubuntu-vm1:/temp2# date +%N
697812034
root@ubuntu-vm1:/temp2# date +%N
937944824
SEQ ( Sequence )
Creates a sequence of numbers and sends to std out
root@ubuntu-vm1:~# seq 4
1
2
3
4
root@ubuntu-vm1:~# seq 4
1
2
3
4
CTRL-Z and FG
CTRL-Z STOP
FG Foreground (Send To)
CTRL-Z
sends a job to the background AND STOP
CTRL-C
will kill it
FG
will send it to the foreground
<command>&
start job and send to the background AND CONTINUE
WATCH <file>
get updates while it is processing
JOBS
list jobs
root@ubuntu-vm1:~# seq 10000000 > junk1.data
^Z
[1]+ Stopped seq 10000000 > junk1.data
root@ubuntu-vm1:~# fg
seq 10000000 > junk1.data
SORT (Similar to CAT)
root@ubuntu-vm1:/temp2# cat junk1.data
5
1
9
3
LinuxCBT
debian
RedHat
root@ubuntu-vm1:/temp2# sort junk1.data
1
3
5
9
debian
LinuxCBT
RedHat
UNIQ
root@ubuntu-vm1:/temp2# sort junk1.data | uniq
1
3
5
9
debian
LinuxCBT
RedHat
CUT ( Cut Columns from piped input )
Cut Columns
Takes piped input, cuts a –f field ( column ) by –d delimiter ‘:’
cat /etc/passwd
setup:x:1000:1000:Setup,,,:/home/setup:/bin/bash
remote:x:1001:1001:Remote,,,:/home/remote:/bin/bash
test:x:1002:1002::/home/test:/bin/sh
sshd:x:115:65534::/var/run/sshd:/usr/sbin/nologin
gnugk:x:116:125:GNUgk daemon,,,:/var/run/gnugk:/bin/false
cat /etc/passwd | cut -d: -f6
/home/setup
/home/remote
/home/test
/var/run/sshd
/var/run/gnugk
TR ( Translation )
operate on characters
-c compliment
-d delete
-s squeeze repeats
posix standard
[:upper:]
[:lower:]
root@ubuntu-vm1:/temp2# echo FILE1 | tr A-Z a-z
file1
root@ubuntu-vm1:/temp2# echo FILEEEEEEEE1 | tr -s A-Z a-z
file1
root@ubuntu-vm1:/temp2# echo FILE1 | tr [:upper:] [:lower:]
file1
root@ubuntu-vm1:/temp2# echo FILE1 | tr -s A-Z a-z | tr [:upper:] [:lower:]
file1
root@ubuntu-vm1:/temp2# echo FILE1 | tr -c A-Z z
FILEzzroot@ubuntu-vm1:/temp2#
Scripted Version
use ‘less *’ to print the script contents to the screen
#! /bin/bash
#Author: Lance Roberts
#Date: 03.40.2013
#Purpose: Illustrate using tr in a script to convert upper to lower filenames
myscriptname=`basename $0`;
#exit;
for i in `ls -A`
do
if [ $i = $myscriptname ]
then
echo "Sorry, can't rename myself!"
elif [ $i != $myscriptname ]
then
newname=`echo $i | tr a-z A-Z`
mv $i $newname
fi
done
RUNNING IT…
root@ubuntu-vm1:/temp2/temp2a# sh tr1.sh
mv: `FILE1' and `FILE1' are the same file
mv: `FILE2' and `FILE2' are the same file
mv: `FILE3' and `FILE3' are the same file
mv: `FILE4' and `FILE4' are the same file
mv: `FILE5' and `FILE5' are the same file
Sorry, can't rename myself!
Built-In Commands
Commands that are built into the command shell
Other ones reside in the filesystem ( ‘which *’ to find where )
echo
pwd print working directory
cd change directory
cd / absolute root
cd .. up one directory
ls
dir symbolic link in linux OS
cd alone will cd to ~/home
Change dir up 3 levels
cd ../../../
read read variables from stdin
PWD
BASH shell updates these variables automatically each time a directory is changed
PWD
OLDPWD
root@ubuntu-vm1:/temp2/temp2a# pwd
/temp2/temp2a
root@ubuntu-vm1:/temp2/temp2a# cd ..
root@ubuntu-vm1:/temp2# pwd
/temp2
CD
change dir to root
root@ubuntu-vm1:~# cd /
change dir to $HOME (~)
root@ubuntu-vm1:/# cd ~
root@ubuntu-vm1:~#
READ
root@ubuntu-vm1:~# read test
testing
root@ubuntu-vm1:~# echo $test
testing
root@ubuntu-vm1:~# read var1 var2
one
root@ubuntu-vm1:~# read var1 var2
one two
root@ubuntu-vm1:~# read -n 3 answer
yesroot@ubuntu-vm1:~# echo $answer
yes
SET & UNSET
set print variable information
unset remove variable
root@ubuntu-vm1:~# unset var1
root@ubuntu-vm1:~# echo var1
var1
root@ubuntu-vm1:~# echo $var1
SOURCE
executes a shell script
root@ubuntu-vm1:/temp2# ls -l testsource.sh
-rw-r--r-- 1 root root 83 Apr 3 19:27 testsource.sh
root@ubuntu-vm1:/temp2# ./testsource.sh
bash: ./testsource.sh: Permission denied
root@ubuntu-vm1:/temp2# source testsource.sh
hello world
root@ubuntu-vm1:/temp2# cat testsource.sh
#!/bin/bash
# the above tells the shell this is a shell script
echo hello world
EXPORT
Ensure the variable is available
root@ubuntu-vm1:/temp2# TESTVAR=1000
root@ubuntu-vm1:/temp2# set | grep TEST
TESTVAR=1000
Shell Expansions
Numerous type of expansions
- Brace Expansion
- Tilde Expansion
- Arithmetic Expansion
- Command Substitution
Brace Expansion
root@ubuntu-vm1:/temp2/temp3# touch test{1,2,3}
root@ubuntu-vm1:/temp2/temp3# ls
test1 test2 test3
root@ubuntu-vm1:/temp2/temp3# touch test{1,2,3}file
root@ubuntu-vm1:/temp2/temp3# ls
test1 test1file test2 test2file test3 test3file
root@ubuntu-vm1:/temp2/temp3# rm -rf *
root@ubuntu-vm1:/temp2/temp3# touch files{1,2,3}
root@ubuntu-vm1:/temp2/temp3# ls -l
total 0
-rw-r--r-- 1 root root 0 Apr 3 21:55 files1
-rw-r--r-- 1 root root 0 Apr 3 21:55 files2
-rw-r--r-- 1 root root 0 Apr 3 21:55 files3
root@ubuntu-vm1:/temp2/temp3# rm -rf files{1,2,3}
root@ubuntu-vm1:/temp2/temp3# ls -l
total 0
Aliases
assigned to a function
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
ALIAS
root@ubuntu-vm1:~# alias
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
ALIAS ( Setting an alias )
root@ubuntu-vm1:~# alias ls='ls -l'
root@ubuntu-vm1:~# alias delete='rm -i'
UNALIAS ( Unsetting an alias )
root@ubuntu-vm1:~# unalias delete
Exit Status Unsetting an alias
All commands return an exit code upon completion
8bit: 0-255 values
errorlevel stored in ‘?’
Use echo $?
Here, echo will re-write the ? variable, so need to capture it immediate before being overwritten
root@ubuntu-vm1:~/temp2# ls; echo $?
# Description
1 Fails to run (valid command with bad argument
127 Running non-existent command
126 permission problems ( ie. file note executable )
Control error status in scripts
exit 1
exit 150
exit 240
Then user can drive logic off these status codes for intelligent scripting.
Command Chaining
root@ubuntu-vm1:~/temp2# pwd; echo hello world
/home/setup/temp2
hello world
When editing long lines, CTRL-A and CTRL-E will assist with navigating long lines
CTRL-A Start of the line
CTRL-E End of the line
root@ubuntu-vm1:~# clear;cd /;ls -l;echo you are in $PWD;echo time to go back home;cd ~
Command Lists
&&
Execute <command2> if <command1> succeeds ( returns errorlevel=0 )
<command1> && <command2>
root@ubuntu-vm1:~# ls -l && pwd
||
Execute < command2> if <command1> fails ( errorlevel<>0 )
<command1> && <command2>
root@ubuntu-vm1:~# ls -l || pwd
I/O Redirection
File descriptors:
0 STDIN KEYBOARD
1 STDOUT SCREEN
2 STDERROR ------
vi
i insert
___________________
Hello World
___________________
:wq save,quit ( or :quit )
root@ubuntu-vm1:~/temp2# cat < helloworld.txt
Hello World
root@ubuntu-vm1:~/temp2# grep Hello < helloworld.txt
Hello World
< input redirection
> redirect to
>> redirect / append redirection
NOTE: grep the redirection to search for strings and return whole line
CAT contents of one file to another
root@ubuntu-vm1:~/temp2# cat helloworld.txt > helloworld2.txt
root@ubuntu-vm1:~/temp2# cat helloworld.txt >> helloworld2.txt
root@ubuntu-vm1:~/temp2# cat helloworld.txt
Hello World
We're Here
root@ubuntu-vm1:~/temp2# cat helloworld2.txt
Hello World
We're Here
Hello World
We're Here
Piping filtered line of one file to another
Here, grep will only push lines containing ‘Here’ to the output text file
root@ubuntu-vm1:~/temp2# cat helloworld2.txt
Hello World
We're Here
Hello World
We're Here
root@ubuntu-vm1:~/temp2# grep Here < helloworld.txt > helloworld4.txt
root@ubuntu-vm1:~/temp2# cat helloworld4.txt
We're Here
Pipes
Allows to output of one command as an input to another command
NOT command chaining – where commands are run sequentially
CommandA output stream > input stream for CommandB
Pipes with ls command
- list long (ls –l )
- wordcount lines (wc –l)
- wc, default, will include the hidden directory ‘.’
- ls –A ( don’t include hidden files )
- ls –A won’t be output to stdout since it is piped to the ‘wc –l’ command
- the ‘wc –l’ command WILL output to stdout
root@ubuntu-vm1:~/temp2# ls -l
total 28
-rw-r--r-- 1 root root 18 Apr 2 06:06 2013-04-02.log
-rw-r--r-- 1 root root 46 Apr 4 01:08 helloworld2.txt
-rw-r--r-- 1 root root 11 Apr 4 01:13 helloworld4.txt
-rw-r--r-- 1 root root 46 Apr 28 15:03 helloworld5.txt
-rw-r--r-- 1 root root 23 Apr 4 01:06 helloworld.txt
-rw-r--r-- 1 root root 31 Apr 2 07:05 junk1.data
-rw-r--r-- 1 root root 83 Apr 3 19:27 testsource.sh
root@ubuntu-vm1:~/temp2# ls -l | wc -l
8
ls –l sorts alphabetically by default, use sort -r
root@ubuntu-vm1:~/temp2# ls -l | sort -r
total 28
-rw-r--r-- 1 root root 83 Apr 3 19:27 testsource.sh
-rw-r--r-- 1 root root 46 Apr 4 01:08 helloworld2.txt
-rw-r--r-- 1 root root 46 Apr 28 15:03 helloworld5.txt
-rw-r--r-- 1 root root 31 Apr 2 07:05 junk1.data
-rw-r--r-- 1 root root 23 Apr 4 01:06 helloworld.txt
-rw-r--r-- 1 root root 18 Apr 2 06:06 2013-04-02.log
-rw-r--r-- 1 root root 11 Apr 4 01:13 helloworld4.txt
working with tabular data
CUT Command
cut –f 2 –d ‘ ‘
-f 2= field2
-d ‘ ‘ = delimeter of space
root@ubuntu-vm1:~/temp2# cat data2
firstname,lastname
Lance,Roberts
John,Doe
root@ubuntu-vm1:~/temp2# cat data2 | cut -f 2 -d ','
lastname
Roberts
Doe
root@ubuntu-vm1:~/temp2# cat data2 | cut -f 1 -d ','
firstname
Lance
John
root@ubuntu-vm1:~/temp2# cat data3 | cut -f 1 -d ';' | wc
3 3 21
root@ubuntu-vm1:~/temp2# cat data3 | cut -f 1 -d ';' | wc -l
3
PS Command
List processes = ps –ax
root@ubuntu-vm1:~/temp2# ps -ax | grep term
warning: bad ps syntax, perhaps a bogus '-'?
See http://gitorious.org/procps/procps/blobs/master/Documentation/FAQ
2887 ? Ss 0:00 /bin/sh -c gnome-terminal
2888 ? Sl 0:08 gnome-terminal
4147 pts/0 S+ 0:00 grep --color=auto term
root@ubuntu-vm1:~/temp2# ps -ax | grep term | wc -l
warning: bad ps syntax, perhaps a bogus '-'?
See http://gitorious.org/procps/procps/blobs/master/Documentation/FAQ
3
Command Substitution ( `xxxxx` or $() )
output contents of a command, store to variable, use later
special redirect
use of expansions
root@ubuntu-vm1:~/temp2# cat lspath.txt
/etc
/usr
/var
/etc:
total 1152
drwxr-xr-x 3 root root 4096 Oct 17 2012 acpi
-rw-r--r-- 1 root root 2981 Oct 17 2012 adduser.conf
-rw-r--r-- 1 root root 10 Mar 28 23:32 adjtime
..
..
/usr:
total 132
drwxr-xr-x 2 root root 53248 Apr 2 10:15 bin
drwxrwsr-x 10 root users 4096 Apr 2 10:16 eclipse
drwxr-xr-x 2 root root 4096 Apr 2 10:12 games
..
..
/var:
total 48
drwxr-xr-x 2 root root 4096 Apr 2 10:43 backups
drwxr-xr-x 16 root root 4096 Oct 17 2012 cache
drwxrwsrwt 2 root whoopsie 4096 Apr 28 13:07 crash
root@ubuntu-vm1:~/temp2# ls -l `cat lspath.txt` | wc -l
272
Piping results to file
root@ubuntu-vm1:~/temp2# ls -l `cat lspath.txt` > etclisting.txt
Assigning a variable to a command
root@ubuntu-vm1:~/temp2# etcdir=`ls -l /etc`
When echo’ing a this variable, formatting is ugly
root@ubuntu-vm1:~/temp2# echo $etcdir
total 1152 drwxr-xr-x 3 root root 4096 Oct 17 2012 acpi -rw-r--r-- 1 root root 2981 Oct 17 2012 adduser.conf -rw-r—r
So enclose the variable in quotes
root@ubuntu-vm1:~/temp2# echo "$etcdir"
total 1152
drwxr-xr-x 3 root root 4096 Oct 17 2012 acpi
-rw-r--r-- 1 root root 2981 Oct 17 2012 adduser.conf
-rw-r--r-- 1 root root 10 Mar 28 23:32 adjtime
Using $( ) for command substitution
root@ubuntu-vm1:~/temp2# etcdir1=$(ls -l /etc)
root@ubuntu-vm1:~/temp2# ls -l
total 60
-rw-r--r-- 1 root root 18 Apr 2 06:06 2013-04-02.log
-rw-r--r-- 1 root root 33 Apr 28 15:16 data
-rw-r--r-- 1 root root 42 Apr 28 15:19 data2
-rw-r--r-- 1 root root 42 Apr 28 15:20 data3
-rw-r--r-- 1 root root 14822 Apr 28 15:42 etclisting.txt
-rw-r--r-- 1 root root 46 Apr 4 01:08 helloworld2.txt
-rw-r--r-- 1 root root 11 Apr 4 01:13 helloworld4.txt
-rw-r--r-- 1 root root 46 Apr 28 15:03 helloworld5.txt
-rw-r--r-- 1 root root 23 Apr 4 01:06 helloworld.txt
-rw-r--r-- 1 root root 31 Apr 2 07:05 junk1.data
-rw-r--r-- 1 root root 15 Apr 28 15:38 lspath.txt
-rw-r--r-- 1 root root 83 Apr 3 19:27 testsource.sh
root@ubuntu-vm1:~/temp2# temp2count=`ls -A | wc -l`
root@ubuntu-vm1:~/temp2# echo $temp2count
12
Disk Utilization –Human Readable ( DU –h )
root@ubuntu-vm1:~/temp2# du -h `cat lspath.txt`
12K /etc/lightdm
12K /etc/cron.monthly
780K /etc/ssl/certs
8.0K /etc/ssl/private
804K /etc/ssl
NETSTAT Table
root@ubuntu-vm1:~/temp2# sslstatus=`netstat -an | grep 443 | wc -l`
Storing File List
root@ubuntu-vm1:~/temp2# touch list.txt
root@ubuntu-vm1:~/temp2# echo lance >> list.txt
root@ubuntu-vm1:~/temp2# echo roberts >> list.txt
root@ubuntu-vm1:~/temp2# cat list.txt
lance
roberts
root@ubuntu-vm1:~/temp2# filelist=`< list.txt`
root@ubuntu-vm1:~/temp2# echo $filelist
lance roberts
Quoting Nuances
Escape Character = ‘\’
root@ubuntu-vm1:~/temp2# echo this is a test
this is a test
root@ubuntu-vm1:~/temp2# echo is this a question?
is this a question?
root@ubuntu-vm1:~/temp2# echo I love money $
I love money $
root@ubuntu-vm1:~/temp2# echo I love money $thismuch
I love money
root@ubuntu-vm1:~/temp2# echo I love money \$thismuch
I love money $thismuch
SPACES in Filenames
Creating directory with space(s)
root@ubuntu-vm1:~/temp2# mkdir testing directory with a space
Creates ( ls –l )
testing
directory
with
a
space
Remove the dirs, then let’s proceed
root@ubuntu-vm1:~/temp2# rm -rf testing directory with a space
root@ubuntu-vm1:~/temp2# mkdir testing\ directory\ with\ a\ space
root@ubuntu-vm1:~/temp2# ls -l
total 68
-rw-r--r-- 1 root root 18 Apr 2 06:06 2013-04-02.log
-rw-r--r-- 1 root root 33 Apr 28 15:16 data
..
drwxr-xr-x 2 root root 4096 Apr 28 16:10 testing directory with a space
Quotes
‘xxx‘ – strong quotes
“xxx“ – relaxed quotes
$ - variable character
\ - escape character
if the ‘$’ isn’t escaped, unix looks for the variable $var
root@ubuntu-vm1:~/temp2# echo "this is a test $"
this is a test $
root@ubuntu-vm1:~/temp2# echo "this is a test $var"
this is a test
root@ubuntu-vm1:~/temp2#
root@ubuntu-vm1:~/temp2# echo 'this is a test $var'
this is a test $var
root@ubuntu-vm1:~/temp2# echo "this is a test \$var"
this is a test $var
When in double quotes, need to escape reserved words and variables:
root@ubuntu-vm1:~/temp2# echo "this is a test $ \"
> ^C
root@ubuntu-vm1:~/temp2# echo "this is a test $ \\"
this is a test $ \
Strings in single quotes won’t have to be escaped
root@ubuntu-vm1:~/temp2# echo 'this is a test $ \'
this is a test $ \
Hello World I
Interpreter designation
- Interpreter should be the first line
- Good practice to have and #END line as well
- file extension should be ‘.sh’ for BASH scripts
helloworld.sh:
#!/bin/bash
echo hello world
#END
SOURCE & ‘./’
Executing with SOURCE
root@ubuntu-vm1:~/temp2# source helloworld.sh
hello world
./hello with TAB COMPLETION not working means it isn’t executable
root@ubuntu-vm1:~/temp2# ./helloworld.sh
bash: ./helloworld.sh: Permission denied
CHMOD
chmod +x = everyone can run
chmod a+x = administrator
chmod u+x = user(root in this case)
root@ubuntu-vm1:~/temp2# chmod u+x helloworld.sh
-rwxr--r-- 1 root root 36 Apr 28 16:27 helloworld.sh
Hello World II
Adding Variables
Global Variables set outside functions, used anywhere in script
Local Variables set inside functions and die with them
#!/bin/bash
# Date: 04.28.2013
# Author: Lance Roberts
# Purpose: Hello World
MESSAGE="hello world"
MESSAGE2="The world belongs to me"
#clear
echo "$MESSAGE"
echo "$MESSAGE2"
#END
More items in the script
#!/bin/bash
# Date: 04.28.2013
# Author: Lance Roberts
# Purpose: Hello World
#Variables Begin
MESSAGE="hello world"
MESSAGE2="The world belongs to me"
#Code Begin
clear
#date +%F=date, %r = time
date +%F\ %r
echo "$MESSAGE"
echo "$MESSAGE2"
#END
root@ubuntu-vm1:~/temp2# ./helloworld.sh > helloworld.txt; cat helloworld.txt
2013-04-28 05:08:34 PM
hello world
The world belongs to me
Hello World III
Reading StdIn
echo What is your name?
read name
echo Hello $name
echo How are you doing?
read feeling
echo You said you were feeling $feeling
Echo name of the script and its path ( ‘basename $0’ )
echo Script Name: `basename $0`
echo Script Location: $0
Script Name: helloworld.sh
Script Location: ./helloworld.sh
Sequential Execution
echo You are currently in the directory $PWD;echo And the current local time is `date +%r`
You are currently in the directory /home/setup/temp2
And the current local time is 05:31:29 PM
Source a separate file (‘.’ or ‘source’)
. filename.sh
source filename.sh
HEAD (Print top to –n lines )
root@ubuntu-vm1:~/temp2# head -n 1 helloworld.sh
#!/bin/bash
root@ubuntu-vm1:~/temp2# head -n 2 helloworld.sh
#!/bin/bash
# Date: 04.28.2013
helloworld.sh that includes helloworld2.sh
. helloworld2.sh
source helloworld2.sh
helloworld2.sh
MESSAGE3="we are testing BASH includes"
echo $MESSAGE3
You are currently in the directory /home/setup/temp2
And the current local time is 05:39:11 PM
we are testing BASH includes
we are testing BASH includes
Functions
Define function FIRST, then can make call
‘function’ is optional
function funcname(){
}
funcname(){
}
Basic Script with StdIn input and sending a Mail item to Admin
#!/bin/bash
# Date: 04.28.2013
# Author: Lance Roberts
# Purpose: Function Definition
# Created: 04.28.2013
# Modified:
function showdate() {
date +%F
}
function showtime(){
date +%r
}
function getuserinfo(){
clear
echo Please enter first name, then last name
read firstname lastname
echo Hello $firstname $lastname
}
mailadmin(){
echo success | mail -s "Successfull Execution of script" root
}
showtime
showdate
getuserinfo
mailadmin
#END
For Loops I
MUST HAVE SPACES AROUND BRACES and BRACKETS
BAD [“ “]
GOOD [ “ “ ]
# For Loop syntax
# for arg in [list]; do action item done
for countries in USA Australia France Latvia Argentina Jamaica
do
echo $countries
done
#!/bin/bash
#Author: Lance Roberts
#Date: 04.28.2013
# For Loop syntax
# for arg in [list]; do action item done
for file in `ls -A`
do
echo $file
done
#END
For Loops II
- LET command
- CUT command
- EXIT 0 to control exit code for…
- echo $?
#!/bin/bash
#Author: Lance Roberts
#Date: 04.28.2013
# For Loop syntax
# for arg in [list]; do action item done
PASSFILE="/etc/passwd"
COUNT=0
for user in `cat $PASSFILE | cut -f 1 -d ':'`
do
echo $user
let "COUNT += 1"
done
echo There are $COUNT users registered on the system
exit 0
#END
WHILE LOOPS
^C = interrupting a loop
LOOP WHILE TRUE
LOOP UNTIL FALSE
#!/bin/bash
# Author: Lance Roberts
# Date: 04.28.2013
NUM=0
MAX=20
while [ "$NUM" -le "$MAX" ]
do
echo $NUM
let "NUM += 1"
done
#END
Command substitution can be used in the while loop also
while [ "`command substitution`" ]
do
echo $NUM
let "NUM += 1"
done
UNTIL LOOPS
LOOP WHILE FALSE
LOOP UNTIL TRUE
^Z to break the program
^C might only break the current command
#!/bin/bash
# Author: Lance Roberts
# Date: 04.28.2013
#PING until a successful ping occurs ($? == 0)
until [ "$STATUS" -eq "0" ]
do
ping -c 1 192.168.0.1
echo The host is down
STATUS=`echo $?`
done
#END
Control Structures I
#!/bin/bash
#Author: Lance Roberts
#Date: 04.28.2013
# For Loop syntax
# for arg in [list]; do action item done
for countries in USA Australia France Latvia Argentina Jamaica
do
if [ "$countries" = "USA" ]
then
echo Welcome to the USA
elif [ "$countries" = "Jamaica" ]
then
echo One Love
else
echo You are from $countries not USA or Jamaica
fi
done
#END
root@ubuntu-vm1:~/temp2# . forloop1.sh
Welcome to the USA
You are from Australia not USA or Jamaica
You are from France not USA or Jamaica
You are from Latvia not USA or Jamaica
You are from Argentina not USA or Jamaica
One Love
Control Structures II
IF FILE EXISTS (-e)
FILE="helloworld.sh"
if [ -e "$FILE" ]
then
echo The file exists
else
echo The file does not exist
fi
IF DIR EXISTS (-d)
FILE="test"
if [ -d "$FILE" ]
then
echo The file exists
else
echo The file does not exist
fi
Using Exit Status ( $? )
#!/bin/bash
# Author: Lance Roberts
# Date: 04.28.2013
netstat -ant | grep :80
APACHESTATUS="$?"
if [ "$APACHESTATUS" -eq 0 ]
then
echo Apache is Up and Running
else
echo Apache is NOT Running
fi
#END
Case Statement
#!/bin/bash
#Author: Lance Roberts
#Date: 04.28.2013
# For Loop syntax
# for arg in [list]; do action item done
for countries in USA Australia France Latvia Argentina Jamaica Cuba
do
echo "Current Country: `echo $countries`:"
case $countries in USA )
echo "Welcome to North America" ;;
Australia )
echo "Good Day Mate";;
France )
echo "Merci";;
Latvia )
echo "Welcome to the former USSR";;
Argentina )
echo "Buenos Dias";;
Jamaica )
echo "One Love";;
* )
echo "Welcome to another land";;
esac
done
#END
Control Structures IIII
Passing Parameters to Shell Scripts
Positional Parameters
- . scriptname.sh 1 2 3 4 5 6 7 8 9 10 11 12 13
- To access params 9+, use ${10}, ${11}
- echo ${10}
- echo ${11}
#!/bin/bash
# Author: Lance Roberts
# Date: 04.28.2013
BADPARAM=165
# shows how many pos params passed to script
echo $#
if [ $# != 2 ]
then
echo This script requires exactly 2 args
echo "You've entered $# parameters"
exit $BADPARAM
fi
#seq min-max
seq $1 $2
#END
Select Menus
#!/bin/bash
# Author: Lance Roberts
# Date: 04.28.2013
# Purpose: Illustrate basic usage of select
PS3='Please select a choice: '
LIST="MySQL System Quit"
# Can use space-delimited string as a list also
# select i in "Choice1 Choice2"
select i in $LIST
do
if [ $i = "MySQL" ]
then
watch tail /var/log/mysql.log
elif [ $i = "System" ]
then
watch tail /var/log/mail.log
elif [ $i = "Quit" ]
then
echo "Exiting..."
exit
fi
# break
done
#END
Move Many Files
#!/bin/bash
# Author: Lance Roberts
# Date: 04.28.2013
# Purpose: Use to rename many files
COUNT=0
BADARG=165
REQPARAM=2
#touch test{1,2}
if [ $# != $REQPARAM ]
then
echo incorrect number of arguments passed
exit $BADARG
fi
for file in `ls -A $1*`
do
# echo $file
mv $file $file.$2
let "COUNT += 1"
done
echo "$COUNT file(s) were moved"
function movetests(){
for file in `ls -A test*`
do
# echo $file
if [ -e "$file" ]
then
mv $file linuxcbt-$COUNT
fi
let "COUNT += 1"
done
}
#END
Network Check
File Differences
Tutorials
Installing MySQL ( Server and Client)
apt-get install mysql-server mysql-client
root | root
Installing Apache2
apt-get install apache2
Apache's default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.
Open a browser with the system’s local IP Address: http://000.000.000.000/
produces a page with “IT WORKS!!”
Installing PHP5
apt-get install php5 libapache2-mod-php5
/etc/init.d/apache2 restart
pico /var/www/info.php
<?php
phpinfo();
?>
Open a browser with the system’s local IP Address: http://000.000.000.000/info.php
Checking NetStat
root@ubuntu-vm1:/usr/bin# netstat -ant | grep :3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
root@ubuntu-vm1:/usr/bin# netstat -ant | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 1 0 192.168.0.20:52675 91.189.89.144:80 CLOSE_WAIT
PENDING
To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:
apt-cache search php5
Pick the ones you need and install them like this:
apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Now restart Apache2:
/etc/init.d/apache2 restart
6 Getting MySQL Support In PHP5
To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:
apt-cache search php5
Pick the ones you need and install them like this:
apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Now restart Apache2:
/etc/init.d/apache2 restart
Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:
7 phpMyAdmin
phpMyAdmin is a web interface through which you can manage your MySQL databases. It's a good idea to install it:
apt-get install phpmyadmin
You will see the following questions:
Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No
Afterwards, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/:
Install Output
root@ubuntu-vm1:~/temp2# apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libc-client2007e libgif4 libmcrypt4 libming1 librecode0 libtidy-0.99-0 mlock
pslib1
Suggested packages:
uw-mailutils libmcrypt-dev mcrypt php5-dev memcached
The following NEW packages will be installed:
libc-client2007e libgif4 libmcrypt4 libming1 librecode0 libtidy-0.99-0 mlock
php-pear php5-curl php5-gd php5-imagick php5-imap php5-intl php5-mcrypt
php5-memcache php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp
php5-sqlite php5-tidy php5-xmlrpc php5-xsl pslib1
0 upgraded, 26 newly installed, 0 to remove and 45 not upgraded.
Need to get 3,000 kB of archives.
After this operation, 9,110 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ quantal/main libgif4 i386 4.1.6-9.1ubuntu1 [31.2 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ quantal/main librecode0 i386 3.6-20 [708 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-curl i386 5.4.6-1ubuntu1.2 [29.1 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-gd i386 5.4.6-1ubuntu1.2 [34.0 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/universe php5-intl i386 5.4.6-1ubuntu1.2 [70.2 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-mysql i386 5.4.6-1ubuntu1.2 [75.6 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-pspell i386 5.4.6-1ubuntu1.2 [8,692 B]
Get:8 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-recode i386 5.4.6-1ubuntu1.2 [5,206 B]
Get:9 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-snmp i386 5.4.6-1ubuntu1.2 [20.5 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-sqlite i386 5.4.6-1ubuntu1.2 [28.1 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu/ quantal/main libtidy-0.99-0 i386 20091223cvs-1.2 [146 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-tidy i386 5.4.6-1ubuntu1.2 [19.1 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-xmlrpc i386 5.4.6-1ubuntu1.2 [36.9 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-xsl i386 5.4.6-1ubuntu1.2 [14.8 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu/ quantal/universe mlock i386 8:2007e~dfsg-3.2ubuntu2 [11.8 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu/ quantal/universe libc-client2007e i386 8:2007e~dfsg-3.2ubuntu2 [736 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu/ quantal/universe libmcrypt4 i386 2.5.8-3.1 [76.1 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu/ quantal/universe libming1 i386 1:0.4.4-1.1ubuntu2 [183 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php-pear all 5.4.6-1ubuntu1.2 [369 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu/ quantal/universe php5-imagick i386 3.1.0~rc1-1build2 [113 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu/ quantal/universe php5-imap i386 5.4.6-0ubuntu1 [38.7 kB]
Get:22 http://us.archive.ubuntu.com/ubuntu/ quantal/universe php5-mcrypt i386 5.4.6-0ubuntu1 [18.2 kB]
Get:23 http://us.archive.ubuntu.com/ubuntu/ quantal/universe php5-memcache i386 3.0.6-6 [59.3 kB]
Get:24 http://us.archive.ubuntu.com/ubuntu/ quantal/universe php5-ming i386 1:0.4.4-1.1ubuntu2 [49.8 kB]
Get:25 http://us.archive.ubuntu.com/ubuntu/ quantal/universe pslib1 i386 0.4.5-3 [96.7 kB]
Get:26 http://us.archive.ubuntu.com/ubuntu/ quantal/universe php5-ps i386 1.3.6-7build1 [20.5 kB]
Fetched 3,000 kB in 12s (236 kB/s)
Selecting previously unselected package libgif4:i386.
(Reading database ... 190958 files and directories currently installed.)
Unpacking libgif4:i386 (from .../libgif4_4.1.6-9.1ubuntu1_i386.deb) ...
Selecting previously unselected package librecode0:i386.
Unpacking librecode0:i386 (from .../librecode0_3.6-20_i386.deb) ...
Selecting previously unselected package php5-curl.
Unpacking php5-curl (from .../php5-curl_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-gd.
Unpacking php5-gd (from .../php5-gd_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-intl.
Unpacking php5-intl (from .../php5-intl_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-mysql.
Unpacking php5-mysql (from .../php5-mysql_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-pspell.
Unpacking php5-pspell (from .../php5-pspell_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-recode.
Unpacking php5-recode (from .../php5-recode_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-snmp.
Unpacking php5-snmp (from .../php5-snmp_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-sqlite.
Unpacking php5-sqlite (from .../php5-sqlite_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package libtidy-0.99-0.
Unpacking libtidy-0.99-0 (from .../libtidy-0.99-0_20091223cvs-1.2_i386.deb) ...
Selecting previously unselected package php5-tidy.
Unpacking php5-tidy (from .../php5-tidy_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-xmlrpc.
Unpacking php5-xmlrpc (from .../php5-xmlrpc_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5-xsl.
Unpacking php5-xsl (from .../php5-xsl_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package mlock.
Unpacking mlock (from .../mlock_8%3a2007e~dfsg-3.2ubuntu2_i386.deb) ...
Selecting previously unselected package libc-client2007e.
Unpacking libc-client2007e (from .../libc-client2007e_8%3a2007e~dfsg-3.2ubuntu2_i386.deb) ...
Selecting previously unselected package libmcrypt4.
Unpacking libmcrypt4 (from .../libmcrypt4_2.5.8-3.1_i386.deb) ...
Selecting previously unselected package libming1.
Unpacking libming1 (from .../libming1_1%3a0.4.4-1.1ubuntu2_i386.deb) ...
Selecting previously unselected package php-pear.
Unpacking php-pear (from .../php-pear_5.4.6-1ubuntu1.2_all.deb) ...
Selecting previously unselected package php5-imagick.
Unpacking php5-imagick (from .../php5-imagick_3.1.0~rc1-1build2_i386.deb) ...
Selecting previously unselected package php5-imap.
Unpacking php5-imap (from .../php5-imap_5.4.6-0ubuntu1_i386.deb) ...
Selecting previously unselected package php5-mcrypt.
Unpacking php5-mcrypt (from .../php5-mcrypt_5.4.6-0ubuntu1_i386.deb) ...
Selecting previously unselected package php5-memcache.
Unpacking php5-memcache (from .../php5-memcache_3.0.6-6_i386.deb) ...
Selecting previously unselected package php5-ming.
Unpacking php5-ming (from .../php5-ming_1%3a0.4.4-1.1ubuntu2_i386.deb) ...
Selecting previously unselected package pslib1.
Unpacking pslib1 (from .../pslib1_0.4.5-3_i386.deb) ...
Selecting previously unselected package php5-ps.
Unpacking php5-ps (from .../php5-ps_1.3.6-7build1_i386.deb) ...
Processing triggers for libapache2-mod-php5 ...
* Reloading web server config apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Processing triggers for man-db ...
Processing triggers for doc-base ...
Processing 1 added doc-base file...
Setting up libgif4:i386 (4.1.6-9.1ubuntu1) ...
Setting up librecode0:i386 (3.6-20) ...
Setting up php5-curl (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/curl.ini with new version
Setting up php5-gd (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/gd.ini with new version
Setting up php5-intl (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/intl.ini with new version
Setting up php5-mysql (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/mysql.ini with new version
Creating config file /etc/php5/mods-available/mysqli.ini with new version
Creating config file /etc/php5/mods-available/pdo_mysql.ini with new version
Setting up php5-pspell (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/pspell.ini with new version
Setting up php5-recode (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/recode.ini with new version
Setting up php5-snmp (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/snmp.ini with new version
Setting up php5-sqlite (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/sqlite3.ini with new version
Creating config file /etc/php5/mods-available/pdo_sqlite.ini with new version
Setting up libtidy-0.99-0 (20091223cvs-1.2) ...
Setting up php5-tidy (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/tidy.ini with new version
Setting up php5-xmlrpc (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/xmlrpc.ini with new version
Setting up php5-xsl (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/xsl.ini with new version
Setting up mlock (8:2007e~dfsg-3.2ubuntu2) ...
Setting up libc-client2007e (8:2007e~dfsg-3.2ubuntu2) ...
Setting up libmcrypt4 (2.5.8-3.1) ...
Setting up libming1 (1:0.4.4-1.1ubuntu2) ...
Setting up php-pear (5.4.6-1ubuntu1.2) ...
Setting up php5-imagick (3.1.0~rc1-1build2) ...
Creating config file /etc/php5/conf.d/imagick.ini with new version
Setting up php5-imap (5.4.6-0ubuntu1) ...
Setting up php5-mcrypt (5.4.6-0ubuntu1) ...
Setting up php5-memcache (3.0.6-6) ...
Setting up php5-ming (1:0.4.4-1.1ubuntu2) ...
Setting up pslib1 (0.4.5-3) ...
Processing triggers for libapache2-mod-php5 ...
* Reloading web server config apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up php5-ps (1.3.6-7build1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for libapache2-mod-php5 ...
* Reloading web server config apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
root@ubuntu-vm1:~/temp2# /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
root@ubuntu-vm1:~/temp2# apt-get install phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
dbconfig-common
The following NEW packages will be installed:
dbconfig-common phpmyadmin
0 upgraded, 2 newly installed, 0 to remove and 45 not upgraded.
Need to get 5,845 kB of archives.
After this operation, 16.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ quantal/main dbconfig-common all 1.8.47+nmu1 [468 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ quantal/universe phpmyadmin all 4:3.4.11.1-1 [5,377 kB]
Fetched 5,845 kB in 18s (311 kB/s)
Preconfiguring packages ...
Selecting previously unselected package dbconfig-common.
(Reading database ... 191325 files and directories currently installed.)
Unpacking dbconfig-common (from .../dbconfig-common_1.8.47+nmu1_all.deb) ...
Selecting previously unselected package phpmyadmin.
Unpacking phpmyadmin (from .../phpmyadmin_4%3a3.4.11.1-1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for doc-base ...
Processing 1 added doc-base file...
Setting up dbconfig-common (1.8.47+nmu1) ...
Creating config file /etc/dbconfig-common/config with new version
Setting up phpmyadmin (4:3.4.11.1-1) ...
dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
Creating config file /etc/dbconfig-common/phpmyadmin.conf with new version
Creating config file /etc/phpmyadmin/config-db.php with new version
* Reloading web server config apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
8 Links
- Apache: http://httpd.apache.org/
- PHP: http://www.php.net/
- MySQL: http://www.mysql.com/
- Ubuntu: http://www.ubuntu.com/
- phpMyAdmin: http://www.phpmyadmin.net/
OUTPUT
root@ubuntu-vm1:~/temp2# apt-get install mysql-server mysql-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl
libplrpc-perl libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5
mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
libipc-sharedcache-perl tinyca
The following NEW packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl
libplrpc-perl libterm-readkey-perl mysql-client mysql-client-5.5
mysql-client-core-5.5 mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 13 newly installed, 0 to remove and 45 not upgraded.
Need to get 25.8 MB of archives.
After this operation, 89.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ quantal/main libaio1 i386 0.3.109-2ubuntu1 [6,648 B]
Get:2 http://us.archive.ubuntu.com/ubuntu/ quantal/main libnet-daemon-perl all 0.48-1 [43.1 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ quantal/main libplrpc-perl all 0.2020-2 [36.0 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ quantal/main libdbi-perl i386 1.622-1 [854 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ quantal/main libdbd-mysql-perl i386 4.021-1 [98.1 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main mysql-client-core-5.5 i386 5.5.31-0ubuntu0.12.10.1 [1,883 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ quantal/main libterm-readkey-perl i386 2.30-4build4 [28.5 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main mysql-client-5.5 i386 5.5.31-0ubuntu0.12.10.1 [8,148 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main mysql-server-core-5.5 i386 5.5.31-0ubuntu0.12.10.1 [5,811 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main mysql-server-5.5 i386 5.5.31-0ubuntu0.12.10.1 [8,764 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu/ quantal/main libhtml-template-perl all 2.91-1 [65.1 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main mysql-client all 5.5.31-0ubuntu0.12.10.1 [11.3 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main mysql-server all 5.5.31-0ubuntu0.12.10.1 [11.5 kB]
Fetched 25.8 MB in 1min 23s (309 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libaio1:i386.
(Reading database ... 189860 files and directories currently installed.)
Unpacking libaio1:i386 (from .../libaio1_0.3.109-2ubuntu1_i386.deb) ...
Selecting previously unselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.48-1_all.deb) ...
Selecting previously unselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ...
Selecting previously unselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.622-1_i386.deb) ...
Selecting previously unselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.021-1_i386.deb) ...
Selecting previously unselected package mysql-client-core-5.5.
Unpacking mysql-client-core-5.5 (from .../mysql-client-core-5.5_5.5.31-0ubuntu0.12.10.1_i386.deb) ...
Selecting previously unselected package libterm-readkey-perl.
Unpacking libterm-readkey-perl (from .../libterm-readkey-perl_2.30-4build4_i386.deb) ...
Selecting previously unselected package mysql-client-5.5.
Unpacking mysql-client-5.5 (from .../mysql-client-5.5_5.5.31-0ubuntu0.12.10.1_i386.deb) ...
Selecting previously unselected package mysql-server-core-5.5.
Unpacking mysql-server-core-5.5 (from .../mysql-server-core-5.5_5.5.31-0ubuntu0.12.10.1_i386.deb) ...
Selecting previously unselected package mysql-server-5.5.
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.31-0ubuntu0.12.10.1_i386.deb) ...
Selecting previously unselected package libhtml-template-perl.
Unpacking libhtml-template-perl (from .../libhtml-template-perl_2.91-1_all.deb) ...
Selecting previously unselected package mysql-client.
Unpacking mysql-client (from .../mysql-client_5.5.31-0ubuntu0.12.10.1_all.deb) ...
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.31-0ubuntu0.12.10.1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up libaio1:i386 (0.3.109-2ubuntu1) ...
Setting up libnet-daemon-perl (0.48-1) ...
Setting up libplrpc-perl (0.2020-2) ...
Setting up libdbi-perl (1.622-1) ...
Setting up libdbd-mysql-perl (4.021-1) ...
Setting up mysql-client-core-5.5 (5.5.31-0ubuntu0.12.10.1) ...
Setting up libterm-readkey-perl (2.30-4build4) ...
Setting up mysql-client-5.5 (5.5.31-0ubuntu0.12.10.1) ...
Setting up mysql-server-core-5.5 (5.5.31-0ubuntu0.12.10.1) ...
Setting up mysql-server-5.5 (5.5.31-0ubuntu0.12.10.1) ...
mysql start/running, process 18356
Setting up libhtml-template-perl (2.91-1) ...
Setting up mysql-client (5.5.31-0ubuntu0.12.10.1) ...
Processing triggers for ureadahead ...
Setting up mysql-server (5.5.31-0ubuntu0.12.10.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@ubuntu-vm1:~/temp2# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
0 upgraded, 9 newly installed, 0 to remove and 45 not upgraded.
Need to get 3,506 kB of archives.
After this operation, 9,255 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ quantal/main libapr1 i386 1.4.6-3 [90.8 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ quantal/main libaprutil1 i386 1.4.1-3 [85.0 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ quantal/main libaprutil1-dbd-sqlite3 i386 1.4.1-3 [11.9 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ quantal/main libaprutil1-ldap i386 1.4.1-3 [9,602 B]
Get:5 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main apache2.2-bin i386 2.2.22-6ubuntu2.2 [2,987 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main apache2-utils i386 2.2.22-6ubuntu2.2 [89.8 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main apache2.2-common i386 2.2.22-6ubuntu2.2 [228 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main apache2-mpm-worker i386 2.2.22-6ubuntu2.2 [2,238 B]
Get:9 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main apache2 i386 2.2.22-6ubuntu2.2 [1,440 B]
Fetched 3,506 kB in 12s (283 kB/s)
Selecting previously unselected package libapr1.
(Reading database ... 190333 files and directories currently installed.)
Unpacking libapr1 (from .../libapr1_1.4.6-3_i386.deb) ...
Selecting previously unselected package libaprutil1.
Unpacking libaprutil1 (from .../libaprutil1_1.4.1-3_i386.deb) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3.
Unpacking libaprutil1-dbd-sqlite3 (from .../libaprutil1-dbd-sqlite3_1.4.1-3_i386.deb) ...
Selecting previously unselected package libaprutil1-ldap.
Unpacking libaprutil1-ldap (from .../libaprutil1-ldap_1.4.1-3_i386.deb) ...
Selecting previously unselected package apache2.2-bin.
Unpacking apache2.2-bin (from .../apache2.2-bin_2.2.22-6ubuntu2.2_i386.deb) ...
Selecting previously unselected package apache2-utils.
Unpacking apache2-utils (from .../apache2-utils_2.2.22-6ubuntu2.2_i386.deb) ...
Selecting previously unselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.22-6ubuntu2.2_i386.deb) ...
Selecting previously unselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.22-6ubuntu2.2_i386.deb) ...
Selecting previously unselected package apache2.
Unpacking apache2 (from .../apache2_2.2.22-6ubuntu2.2_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Processing triggers for ufw ...
Setting up libapr1 (1.4.6-3) ...
Setting up libaprutil1 (1.4.1-3) ...
Setting up libaprutil1-dbd-sqlite3 (1.4.1-3) ...
Setting up libaprutil1-ldap (1.4.1-3) ...
Setting up apache2.2-bin (2.2.22-6ubuntu2.2) ...
Setting up apache2-utils (2.2.22-6ubuntu2.2) ...
Setting up apache2.2-common (2.2.22-6ubuntu2.2) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Processing triggers for ureadahead ...
Processing triggers for ufw ...
Setting up apache2-mpm-worker (2.2.22-6ubuntu2.2) ...
* Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up apache2 (2.2.22-6ubuntu2.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@ubuntu-vm1:~/temp2# nano
root@ubuntu-vm1:~/temp2# pico
root@ubuntu-vm1:~/temp2# which pico
/usr/bin/pico
root@ubuntu-vm1:~/temp2# which nano
/usr/bin/nano
root@ubuntu-vm1:~/temp2# apt-get install php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apache2-mpm-prefork php5-cli php5-common
Suggested packages:
php-pear
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5 php5-cli php5-common
0 upgraded, 5 newly installed, 1 to remove and 45 not upgraded.
Need to get 5,798 kB of archives.
After this operation, 17.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main apache2-mpm-prefork i386 2.2.22-6ubuntu2.2 [2,354 B]
Get:2 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-common i386 5.4.6-1ubuntu1.2 [426 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main libapache2-mod-php5 i386 5.4.6-1ubuntu1.2 [2,692 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5 all 5.4.6-1ubuntu1.2 [1,066 B]
Get:5 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main php5-cli i386 5.4.6-1ubuntu1.2 [2,676 kB]
Fetched 5,798 kB in 19s (297 kB/s)
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
apache2 depends on apache2-mpm-worker (= 2.2.22-6ubuntu2.2) | apache2-mpm-prefork (= 2.2.22-6ubuntu2.2) | apache2-mpm-event (= 2.2.22-6ubuntu2.2) | apache2-mpm-itk (= 2.2.22-6ubuntu2.2); however:
Package apache2-mpm-worker is to be removed.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
Package apache2-mpm-itk is not installed.
(Reading database ... 190908 files and directories currently installed.)
Removing apache2-mpm-worker ...
* Stopping web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting [ OK ]
Selecting previously unselected package apache2-mpm-prefork.
(Reading database ... 190905 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.22-6ubuntu2.2_i386.deb) ...
Setting up apache2-mpm-prefork (2.2.22-6ubuntu2.2) ...
* Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Selecting previously unselected package php5-common.
(Reading database ... 190910 files and directories currently installed.)
Unpacking php5-common (from .../php5-common_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.4.6-1ubuntu1.2_i386.deb) ...
Selecting previously unselected package php5.
Unpacking php5 (from .../php5_5.4.6-1ubuntu1.2_all.deb) ...
Selecting previously unselected package php5-cli.
Unpacking php5-cli (from .../php5-cli_5.4.6-1ubuntu1.2_i386.deb) ...
Processing triggers for man-db ...
Setting up php5-common (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/mods-available/pdo.ini with new version
Setting up libapache2-mod-php5 (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/apache2/php.ini with new version
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up php5 (5.4.6-1ubuntu1.2) ...
Setting up php5-cli (5.4.6-1ubuntu1.2) ...
Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode
MAIL UTILS & Mutt
root@ubuntu-vm1:~/temp2# ./helloworld.sh | mail -s "Testing hello world using pipes" root
The program 'mail' is currently not installed. You can install it by typing:
apt-get install mailutils
apt-get install mutt
Selecting LOCAL just for testing locally, no mail server
│ Please select the mail server configuration type that best meets │
│ your needs. │
│ │
│ No configuration: │
│ Should be chosen to leave the current configuration unchanged. │
│ Internet site: │
│ Mail is sent and received directly using SMTP. │
│ Internet with smarthost: │
│ Mail is received directly using SMTP or by running a utility such │
│ as fetchmail. Outgoing mail is sent using a smarthost. │
│ Satellite system: │
│ All mail is sent to another machine, called a 'smarthost', for │
│ delivery. │
│ Local only: │
│ The only delivered mail is the mail for local users. There is no │
│ network.
┌──────────────────────┤ Postfix Configuration ├──────────────────────┐
│ The "mail name" is the domain name used to "qualify" _ALL_ mail │
│ addresses without a domain name. This includes mail to and from │
│ <root>: please do not make your machine send out mail from │
│ root@example.org unless root@example.org has told you to. │
│ │
│ This name will also be used by other programs. It should be the │
│ single, fully qualified domain name (FQDN). │
│ │
│ Thus, if a mail address on the local host is foo@example.org, the │
│ correct value for this option would be example.org. │
│ │
│ System mail name: │
│ │
│ ubuntu-vm1_________________________________________________________ │
Installation Entries
root@ubuntu-vm1:~/temp2# apt-get install mailutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libgsasl7 libmailutils4 libmysqlclient18 libntlm0 mailutils-common
mysql-common postfix
Suggested packages:
mailutils-mh mailutils-doc procmail postfix-mysql postfix-pgsql
postfix-ldap postfix-pcre sasl2-bin dovecot-common postfix-cdb
postfix-doc
The following NEW packages will be installed:
libgsasl7 libmailutils4 libmysqlclient18 libntlm0 mailutils
mailutils-common mysql-common postfix
0 upgraded, 8 newly installed, 0 to remove and 45 not upgraded.
Need to get 3,795 kB of archives.
After this operation, 12.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main mysql-common all 5.5.31-0ubuntu0.12.10.1 [13.3 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main libmysqlclient18 i386 5.5.31-0ubuntu0.12.10.1 [933 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ quantal/universe libntlm0 i386 1.2-1 [18.4 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ quantal/universe libgsasl7 i386 1.8.0-2 [142 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ quantal/universe mailutils-common all 1:2.99.97-3 [450 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ quantal/universe libmailutils4 i386 1:2.99.97-3 [524 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ quantal-updates/main postfix i386 2.9.6-1~12.10.1 [1,276 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ quantal/universe mailutils i386 1:2.99.97-3 [438 kB]
Fetched 3,795 kB in 13s (282 kB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 189420 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_5.5.31-0ubuntu0.12.10.1_all.deb) ...
Selecting previously unselected package libmysqlclient18:i386.
Unpacking libmysqlclient18:i386 (from .../libmysqlclient18_5.5.31-0ubuntu0.12.10.1_i386.deb) ...
Selecting previously unselected package libntlm0.
Unpacking libntlm0 (from .../libntlm0_1.2-1_i386.deb) ...
Selecting previously unselected package libgsasl7.
Unpacking libgsasl7 (from .../libgsasl7_1.8.0-2_i386.deb) ...
Selecting previously unselected package mailutils-common.
Unpacking mailutils-common (from .../mailutils-common_1%3a2.99.97-3_all.deb) ...
Selecting previously unselected package libmailutils4.
Unpacking libmailutils4 (from .../libmailutils4_1%3a2.99.97-3_i386.deb) ...
Selecting previously unselected package postfix.
Unpacking postfix (from .../postfix_2.9.6-1~12.10.1_i386.deb) ...
Selecting previously unselected package mailutils.
Unpacking mailutils (from .../mailutils_1%3a2.99.97-3_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw ...
Setting up mysql-common (5.5.31-0ubuntu0.12.10.1) ...
Setting up libmysqlclient18:i386 (5.5.31-0ubuntu0.12.10.1) ...
Setting up libntlm0 (1.2-1) ...
Setting up libgsasl7 (1.8.0-2) ...
Setting up mailutils-common (1:2.99.97-3) ...
Setting up libmailutils4 (1:2.99.97-3) ...
Setting up postfix (2.9.6-1~12.10.1) ...
Adding group `postfix' (GID 126) ...
Done.
Adding system user `postfix' (UID 117) ...
Adding new user `postfix' (UID 117) with group `postfix' ...
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding sqlite map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (GID 127) ...
Done.
setting myhostname: ubuntu-vm1
setting alias maps
setting alias database
mailname is not a fully qualified domain name. Not changing /etc/mailname.
setting destinations: ubuntu-vm1, localhost.localdomain, localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: loopback-only
setting default_transport: error
setting relay_transport: error
/etc/aliases does not exist, creating it.
WARNING: /etc/aliases exists, but does not have a root alias.
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
* Stopping Postfix Mail Transport Agent postfix [ OK ]
* Starting Postfix Mail Transport Agent postfix [ OK ]
Processing triggers for ureadahead ...
Processing triggers for ufw ...
Setting up mailutils (1:2.99.97-3) ...
update-alternatives: using /usr/bin/frm.mailutils to provide /usr/bin/frm (frm) in auto mode
update-alternatives: using /usr/bin/from.mailutils to provide /usr/bin/from (from) in auto mode
update-alternatives: using /usr/bin/messages.mailutils to provide /usr/bin/messages (messages) in auto mode
update-alternatives: using /usr/bin/movemail.mailutils to provide /usr/bin/movemail (movemail) in auto mode
update-alternatives: using /usr/bin/readmsg.mailutils to provide /usr/bin/readmsg (readmsg) in auto mode
update-alternatives: using /usr/bin/dotlock.mailutils to provide /usr/bin/dotlock (dotlock) in auto mode
update-alternatives: using /usr/bin/mail.mailutils to provide /usr/bin/mailx (mailx) in auto mode
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Terminal Colors
Right-Click in the Terminal, select Profile Preferences
4bit Terminal Color Scheme Designer
http://ciembor.github.com/4bit/#
#!/bin/bash
# Save this script into set_colors.sh, make this file executable and run it:
#
# $ chmod +x set_colors.sh
# $ ./set_colors.sh
#
# Alternatively copy lines below directly into your shell.
gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_theme_background --type bool false
gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_theme_colors --type bool false
gconftool-2 -s -t string /apps/gnome-terminal/profiles/Default/background_color '#0d0d19192626'
gconftool-2 -s -t string /apps/gnome-terminal/profiles/Default/foreground_color '#d9d9e6e6f2f2'
gconftool-2 -s -t string /apps/gnome-terminal/profiles/Default/palette '#000000000000:#b8b87a7a7a7a:#7a7ab8b87a7a:#b8b8b8b87a7a:#7a7a7a7ab8b8:#b8b87a7ab8b8:#7a7ab8b8b8b8:#d9d9d9d9d9d9:#262626262626:#dbdbbdbdbdbd:#bdbddbdbbdbd:#dbdbdbdbbdbd:#bdbdbdbddbdb:#dbdbbdbddbdb:#bdbddbdbdbdb:#ffffffffffff'
APT-GET
PAGE
- The program 'page' is currently not installed. You can install it by typing:
apt-get install tcllib
XXX
- Log in to post comments