Advanced Ubuntu Sheet PDF
Advanced Ubuntu Sheet PDF
Package Management:
dpkg
Example package package_1.0-2_i386.deb sudo dpkg -i package.deb # installs package sudo dpkg -r package # removes package sudo dpkg -S <filename> # which package contains filename sudo dpkg -s package # status or info. on package sudo dpkg --reconfigure package # re-run configure script(s) Flags: -G do not overwright, - overwright if newer -! recursive
gdebi
sudo gde i package # same as dpkg -i ut works like apt-get since it will install dependences from repositories. gdebi-g"k for !"#
ap"-ge"
sudo ap"-ge" upda"e sudo ap"-ge" upgrade sudo ap"-ge" dis"-upgrade sudo ap"-ge" ins"all <package name> sudo ap"-ge" c#eck sudo ap"-ge" au"oremo$e # updates package list # installs new updated packages # smart upgrade to new packages # installs package # check for roken packages # remove an$ orphaned packages
ap"-cac#e
ap"-cac#e searc# <s"ring> ap"-cac#e s#o% <package> ap"-cac#e s#o%pkg <package> ap"-cac#e depends <package> ap"-cac#e rdepends <package> # search name and description # all the information on a package # all dependencies # what it depends on # what depends on it
ap"-file
sudo ap"-ge" ins"all ap"-file sudo ap"-file upda"e ap"-file searc# <s"ring> ap"-file lis" <package> # needs to e installed # s$nc will all repositories # searches for string, local and remote # list contents of package even if not installed
ap"-cac#er
#f $ou have man$ " untu s$stems $ou can cache the apt repositor$ with apt-cacher sudo ap"-ge" ins"all ap"-cac#er # install apt-cacher on server default port apt-cacher is running on is por" 31&2 read: #""p'((%%%.debun"u.org(#o%-"o-se"-up-a-reposi"or)-cac#e-%i"#-ap"-cac#er
s)nap"ic
*o roll back "o a pre$ious $ersion' %) &elect the package so it is highlighted ') From the menu (ackage-)Force *ersion or +trl-e ,) (ick the version $ou want from the dialog +ns"all b) "ask' !roups of packages that make up a task like -./( Edit -) 0/ark (ackages $ 1ask2
3est to follow instructions from package usuall$ a 0tar.g42 or 0tar. 4'2. For the latest code $ou will need to gra the source from the repositor$ with +*&, &*5, !#1 (also install curl), 367 or mercurial. For the example $ou need build-essen"ials, gi" and au"oconf package installed elinks example (http:88elinks.or.c48download.html) : %. gi" clone #""p'((elinks.c,(elinks.gi" # gets the source code '. 7ead the ! -./ and8or +0S*-11 files for instructions9 ,. .(au"ogen.s# # will generate the configure script if it is missing. :. .(configure # install an$ needed dev or re;uisites until runs clean. also set options at this point <. .(make # or 0make all2 will compile the code. &ome sets will include a 0make test2 to verif$ the code efore install. =. sudo .(make ins"all # installs the code
Controlling Services
(e"c(ini".d(<ser$ice> # is the director$ will all the # control scripts for diamonds
sudo (e"c(ini".d(ss# reload # will reload 8etc8ssh8sshd@config 1o control runlevels aka what runs during oot: !"# A bum 34oo" 5p /anager 6 ( needs to e installed ) terminal A s)s$config ( needs to e installed ) note: it will give $ou the service command as in 0sudo service ssh reload2
runle$els in .ebian(5bun"u are 5B1 the same as 7edCat: D &$stem Calt % &ingle user 2 7ull mul"i-user mode 3.efaul"6 ,-< &ame as ' = &$stem 7e oot .s of " untu E.D: (e"c(ini""ab has een removed since upstart is used. 1he file (e"c(e$en".d(rc-defaul" is in control during oot
Controlling Processes
use ps and ps"ree to locate processes. "se &hift-(g"p8(g>n to move up and down in a 11F session &ince " untu starts in runlevel ' therefore gdm 3Gnome .ispla) /anager 6 is left as parent of G-?indows. ( $ou ma$ have kdm or xdm ) #f $ou want to compile and install graphics card drivers $ou must use a 11F ( .lt-+trl-F%-)< ) then stop G-?indows and the displa$ manager. -l"-8"rl-79 is $our !raphics +ard, -l"-8"rl-78 standard error #n !nome $ou can use the 0S)s"em /oni"or2 to control processes "se lsof to list which processes have what files open
Logs
($ar(log(messages ($ar(log(boo" ($ar(log(debug ($ar(log(au"#.log ($ar(log(daemon.log ($ar(log(dmesg ($ar(log(dpkg.log ($ar(log(faillog ($ar(log(kern.log ($ar(log(lpr.log ($ar(log(user.log ($ar(log(2org.0.log ($ar(log(fsck(: ($ar(log(appor".log # !eneral log messages # &$stem oot log # >e ugging log messages # "ser login and authentication logs # 7unning services # -inux kernel ring uffer log # .ll inar$ package logs # "ser failed login log file # Hernel log file # (rinter log file # .ll userlevel logs # G.org log file # fsck command log # .pplication crash report I log file
#ecovery $ectors
3oot from +>, S)s"em!escue8d is recommended, since it can e use to work on all i,J= ased s$stems including windows s$stems. (%%%.s)sresccd.org) #f using &$stem7escue+> to gain network access use ;ne"-se"up e"#0; "se recover$ tools like <e2fsck -c$ (de$(<dri$e>; to fix drives as needed. /ount the partition $ou wish to recover. 1hen cd to that drive, $ou can fix 8 oot8gru mistakes etc. cd to the K8K of the drive and use <c#roo" (de$(<disk> bas#; to move K8K to the install ase $ou want to recover. 5ow $ou can use apt or dpkg to fix things