We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
NEED TO KNOW
>.001 Is
‘can use soli tha fies ana folders that
>.002 ed
ne ed command ensbies you to move
between directories on your system. Like the
felloning, or exargle:
Ws cd merase?
15 ep File Mhoneiseresktop/ile
>004 mv
‘2 copy, mv instead move
thera lost on daletingthaorigins
[15 wv file Mhonehuser/Desktop/file
>.005 rm
‘The rm command is for removing or deleting
Flas and directories, Youcan use:
[smn nite
>_006 mkdir
You can create elractories with the kale
command using something ike
[5 nkdir folder
>007 nano
Nano sone ofthe programs that enables you
to edt tex in les ~ i ital for working ang
eciinginthe command ine. Youuseit kes:
[5 nano fie
>008 Tab
he Tab key enables you to auto-complet
commands and fle names, end double
tapping lets you stall ofthe objects that
have 8 similar name. This auro-completion
works wth unambiguous fle and command
rames. For example, tr’ eves you “iraox
because no other commands neain wt fi
I you get mati inve typing *9
narrow the selection snd hit Tab again
>.209 Up
2 99 the keyboard has the vey simple task af
enabling you co pull up the last command that
vas entered, torunitageinr eit
>010 Copy text
IF youre inthe terminal, you may wars
‘CuteAlt.
copy
9.30 this, you
>o11 Paste text
IF youve found a carmand online or need to
paste some text into nano, you can enter ary
nthe clipzcarcith CuteAIV.
> 012 Open terminal
Thistckworksinalotot
a shortout for pening the termina. canbe dane
with: CuLeAlee,
>013 sudo
This lets you do commands as the super use.
The super user in this ease fs root and you just
sudo tothe start of any command
>014 Access root
‘The superuser, or rat can alse be accecsae by
logging in 85 from the terminal by yp ng. Bu
You can enter the root user password and then
mrmand as root without having to
usesudo sal
>015 Stop processes
IF you have run a command and ether ies
paused, taking ts done ts
Job and you don't need e rest of, you
can stop it forefuly by using either Ctr#C or
HZ. Remember, onty do this the process
is not writing any data as it isnot safe inthis
instance and yeucould find yoursefin trouble.
>016 Access root
without password
IF your regular user i n the sudoers let
that thay ean use sudo in general to run things
8000, you.can access the su account by using
sudo su, Thisuses yournarmal user passwers to
ances root terminal functions.
To ade a roguar user
vvould need to first log in as the suner user by
using eu. Then, you would simaly run adduser
username sudo (placing ‘username. Be
careful whoyou ads tote suloes ls, thougn
> 017 Search for hidden files
and directories
‘The Is command can be used in more than
ust the base way of lating all the files ya
“older. To begin wit, you can use te ist all
the hidden items alongwith the narmalitems
byosing
>018 Home directory shortcut
signify the home directory when
moving between crecto ming. ding
rmastiy anythingelse~ ike with he olloing, for
Bs cd =
>019 Link commands together
Ifyou want todo series of emmards one af
1 other, ke updating and ther upgrading
software in Debian, for example, you can use
{&& to have a command rap ght after the ene
before. For example
IS sudo apt-get update 44 sudo
apt-get install Libreoffice
>020 Long terminal. input
Sometimes when usirgalstorarythingelsa with
‘long terminal output, you might not be able to
read it well. To mave it eaier to under
9 send
‘ough
$ 1s | lessFeature
Readable storage size
eta
bytes though which sno
tweaked)
>_022 Move to previous directory
you wae to mave back tothe drectory that you
were norkng on before, ther is aed commana
eal, Tis one does not move yp the
but rather book tote ast folder ha:
Ised-
>_023 Move up directory
The cd command. also aeused to move upin
the flasystem.Dotis with two fullstos, ke so:
Ise
>024 General wildcards
is&{") can boused asa wildcard
erminal to stand or anything. typoal usecase
's copying or removing specific ypes of les, Far
example, fyouwant ta remove all PNG es from
an
Master the command line
SYSTEM
ESSENTIALS
hat ll lgpiays isthe sze ofthe files that are orate onthe nard ove,
sways that
became more leibe simply by changing she ta th, where the lo
ne human-readable option ¢h)
salu Yeuean havait pars
listing forms option (0
>_025 More with the pipe
he pipe () can be used to feed all outputs into
the next command, enabling you to calla piace
of data or sting from one command and pur it
Straight into the next command. This works wa
grep andathercoreLnuxtoos
3-026 Delete directories
everythingwithina dractary recursively using:
[5 mm + rectory
>_027 Shutdown command
Yousan shutdown the systam from the terminal
Using the shutdown command, the hat opt an
which stope all running programe at
same time, and sp
‘urnsoffimmediately
IL sudo shutdom -h now
>_028 Display all. information
As wos meray isting the ies, we can use
Ueto at allt te information relating ach
fie, such as lst date modes, permssions
[sisa
>029 Reboot from command line
Backinthedayrebootingresuired.aslighty mare
compiax shutdown command: shutdown -f
vith averysimle
[1 sudo reboot
>.030 Timed shutdown
he timing function ofthe shutdown command
can be very useful if you need to wait for
{program of efon joo t0 finish before the
shutdown occurs. You can use the time te do
| normal haltshutdown, er even with =r for a
reboot afzorzen minutes, withsomethingtke:
(15 sudo shutdown -h +12
>031 Log out
Logging out from the x session is generaly
advisable from the desktop environment, but if
you need t log back out t0 she login
you can go the by restarting
Tanager. In the case of many Linux distros, you
Usethecammandielow
IES sudo service Tightdn restartINSTALLATION :
>.022 Debian: update repositories
Debiar-based fond Uburturbased) dros use
‘spsget asthe corvmand na packaga manager
(ne of the quis of aptget a5 a package
‘manager tat before uagrading or insaling
sofa, tcoes not neck to ane thoes =
enor version i the reaositones, Betore doing
anyinstalaonin Debian. se
IES sudo apt-get opiate
>033 Debian: install software
nike a graphical package manager cr software
centre, you can’t quite search for the kind of
packages you want to instal, eo yoU need ta
know the package name before installing, Once
youdoshougn,
[15 sudo apt-get install package
>_034 Debian: update software
You can upgrade the sartwate in Debian from
‘tho trminal by fst performing tho repository
Update command in Tip 32, falloned by the
upgrade command below
ILS sudo apt woerade
>_035 Debian: uninstall software
Ae part of package management, spt-pet
‘enables you to uninstall software as wel. Tris
's simaly done by replacing install with remove
In tha same commana that you would use to
instal said package (Tip $8). You ean also use
purgeinstead ofremoveifyouwanttadeleteary
configties along witht.
>_936 Debian: upgrade distro
Debian systems can often updace to a ‘newer
version, especialy whenit'srolirg orf theres a
new unt Sometimes the prompt won'show
‘up, So you candoitinthetermina ith
5 sudo aptget dist-uperade
>_037 Debian: multiple packages
-very simple thing you can dawhieinstalingon
al platorms is ist muipie packages t install
‘at once with the normal intalation command.
Soin Debian twouldbe:
8 sudo apt-get install packagel
package? packages
2.038 Ddbian: dependencies
ping dirs between saftware ana they"
‘ach have a guide on Mow fo go about i, One
problem you might “eis that Rl top ure
Sou can Fnd and instal the raht dependency.
“ou can got around this ay instaling auto-apt
are then sing during con guration nth
IS sudo auto-apt run /eonfigure:
>.039 Debian: force install
Sometimes whon installing software, antget
will refuse to install if specific requirements
arent met (usualy in terms of other packages
nese tobe installed forthe software te work
proper. You can force the package to instal.
‘even vithouttne dependencies using
sudo apt-get download package
$ sudo dpkg ~1 package
>.04@ Debian: install binary
Ih Tip 39, wo used dpkg -ito install the binary
installer package that we downloaded “om the
repostaries. This same command can be used
‘instal: any downloaded sinary, ether am the
regosorfromaebsite
>04) Debian: manual
force install package
Irthe advice nTin 38s sti not working, you can
force instal itn dpkg. To do this you just neod
to add the option --foree-all to the installation
cemmandto ignore any problems, tke so
ILS suo dpkg —Force-sll “1 package
>042 Red Hat: update software
Unlike apt-get. the yum package manager for
Red HatFacora-based distros does not reed
you to specially undate the repositories. You
‘ean merly update alltheseftwave using
I sudo yun update
>.043 Red Hat: install software
Irstallng itn yur vary simple as ong as yeu
nou the package name. Yum does have some
earch facitas though. you realy need tlle
itup butenee you know what package you want,
Use the folowing corsmane
[1 suo yum instal package
and updatin
Managing y
your sy
rt of the comm
and lit
>044 Red Hat: uninstall software
‘Yum can aso be used to uninstall ary package
you have on your system, whether you installed
Ir direct trom yum or not. As ong a8 you know
‘repackage name youcan uninstall with
Is sudo yum renove package
>045 Red Hat: force install
‘The force instal funetion on Ree Hat ard
Feaora-based Linux doe requires that you
havea packago downloaded! ana ready to instal.
You can dovncad things with yum anc then
‘orcethe install it
[E'S sudo yum install -dounloadonly
dowloaddir=[directory] package
[E'$ sudo rpm ~ivh --force package
>046 Red Hat: manual install
PMs one af the package installers on ec Hat
distros and can be used to instal downloaded
packages. Youcenethar do something ko in Tip
48 and doanlaad the pacxage from the repos, o
evra tram the hternet andinstal with
IL sudo rpm package
>_047 Red Hat: force
manual installation
AS in Tp 45, you can use RPM +9 force install
packages if theres a dependency iesue or
something else wrang with any other packages
‘nat you have oownloaded. The sare command
should be used as in Tip 45, with the hand
“force options present.
> 048 Fedora: distro upgrade
om as sown distribution upgrade command
butoniyin Fedora ard they pete you notte use
ituniss you have to, Nonethess you ean use
tvefedora-upgrad package nyumth
[15 suo yun install fedora-uperade
WYou can force
package to install
even without the
dependenciesFeature | Master the commandline
See
Rela ai
Stop @ system service
2 system service is the kind of background
software that aunchas at startup, These ar
‘onvollad by thesystem management daemons
Uke int or systomd, and ean be centrale from
the terminal with the service
ATTA
Start a service
ee eae lopped by wig the eam sono
BSCR wth sattorent operator. As ongas you now the
ees name staritusing
Pierre se
ee
reds
on erry $ sudo service nane start
eee eee
grep —n hello file
a
eee
fore
cree
cee. Restart a system service
his ene is popular with setting up web servers
that use n rescarts may be
needed, slong her services that you
‘customise along the ws. hstesd of rurning both
‘he stop and stare commands sequer
can instead restart services using
TEC
coerce 7
ees
oo
note)
co
eet S sudo service ane restart
Know the ID
ne ID that you can get forthe softwe
top can be used to manipul
fr ini that you can end the
TUREMEE oroc05s if having trouble stopping itself or
n the [Din hand
Soe ag ec)
eee
ed Using too many resources,
ee RSME you canicltwith
oes
S grep ‘\ch.o file
eee
eee . skin 1234
Kill multiple 1Ds
‘ometimes a process can be spilt up over
with a
eee
mrultile Ds this usvaly
web browser ~ Google
fand you nec to Kil tultple
ther try and auck'y
1 Ds, er use ne cornman nar for the
itwith
nt
es rere
cae eee
5 killall -v process
List connections
he standard command for listing your
work conrecsons snd desais in the
serminal i meraly ifconfig ~ ths wl it all,
you" interfaces and thei stazuses. F you
virelass ntefa:
't 8 sovefie one, say for the
youcanuse:
$ ifeonfig wlane
List USB devices
You may need te know wrich USB and USE-
relates devi nected to a system,
oF find our thet designation. You
need to install it frst, but once you have
ypu ean use Leusb inthe terminal
the avalabiecevices.
List, hard
drives and partitions
of certain drives for working on them 0
just need to gota general understanding of th
systems layout, you can use fdisk tis al the
hava drives. Dothis in thetemina ith
$ sudo fis
Check running software
Sometimes yell want t cheok what's runing
be done simpy wit top. I lst all the relevant
usage, along
uta thelD so yousan contriUnpack a ZIP file
Iryouve downloaded ZP fieand you di trom
the terminal er youre working from you
unpackitusingte unzip command, Useitke so:
$ unzip file zip
Unpack a TAR file
es Linux havea corp
wed as a Aangz, or tarbal
ck these or similar TAR ies
mand, although you need the
‘tne comman i
$ tar -a0f file.taree
Copy and write disks
Coming tom UNKis 2 powerul image tool calles
4, which woo 00" using lot rocontly to
writing Raspberry PSO cards. Use
ses andharacves, andor wring
mage
them back Theis
fis
1 put Fie or erive an the
hesame, mores ike so
fevisda bs=IM
Create an empty file
Sometimes. ashen coding or instaling naw
softnae a fle to write to, You
he terminal has a commane sinilrto mkdir tha
enabiosyoutocreateanempy tie thsistouch
$ touch File
Print into the terminal
he terminal uses acho a princess trom fas
ita the ten ive the C language.
youre writing a Bash script and want to see tho
‘output ofthe current section, you ean use echo
xo printout the rel > straight into the
terminal output
Check an MO5 hash
hen covmloading certain files ican hap alot
Alot of sites wil offer the
mogrty of the downloaded file by comparing &
nach sumbased on t, With that MDS and the fle
location athand,you can compare twit
$ mdSsun file
Run commands to x
Sometimes you need to do
ec the x display, but the enly way you
ccananter tne command ineis by switching to an
a stance vith CumAtE+F2 or similar
Create a new SSH key
yal ned to generate a tong anya
rey, you can abays havea go a reatig iin
‘he termina. You can do eis using yur emai
suds a5 idertiieaton by entorng. the
foloninginothetermirt
S$ ssh-keygen -t rsa -C
“your_evaillexanple.con”
system details
simple
running and you can do this witn th
uname which you ean use in the
terminal he ellowing
$ unare
Kernel version
|S part of uname, you aso get the kernel version.
rowing th for downloading the
ight header flas when coming madules 0
updating certain aspects. You can get purely the
kerolverson by aang +r otion
S$ unane =r
(PU architecture
IWyeu'e an an unknown machin
ned te fine out what i
running Find twat ther
you might
$ uname
Everything else
Uname enabiesyou tod spa
avaiable from the system and
by simply using th
datathatis
a al
of ths informa -aoption
htnecommand!
$ unane a
Ubuntu version
th all the dstro updates you do, it ean be
ey to keep tack of which version of Ubuntu
you aren. Youcancheokty using
5 Isb-release -3
alas
PERMISSIONS
pam
ze] ral alo vae
file permissions ¢
sa ana ACoMtae
them properly
peer eescls
er eee
eer:
Noraee
ne een
with dincestig 3
meeerennee iis
cone
dw stands for»
ant
nat tis re
eee
eaten
Cea eScls
Oe een
an stare 7
eee
Soe aa
a ee eed
eee
i ot
'S cinod 777 file
eet
Phos
read and ¢ coved
eran
ee erm a
ors
eeeFeature | Master the commandline
ear
CONTROLS
>_You can control your
tunes while working
Open files in terminal
IryouNe gota fie you can
manager, stead of 9
ovigating to and then executing the fio srg
for te termina
ed to rghick
ilasie Anal aC ana
you ean usvaly run it eve’
oc this you usualy us
Find files in terminal
You can search ‘or specific fee through
the flosystom by using the find commanc. You
Peat ed to go find a location to search in and a
EMM MCE 2ramec0r to sosrch or, For simply searching or
EEE | 3 cfrom ootwth acpeciicnameyoucan use:
oat $ find / name File
chythnboeclient pause Locate files in terminal
Similar t finds locate, a newer tool chat works
1 diferent ta ‘ind, While find aise has
for fies by age, size, onner anc
yreallyusesthenameto
‘pando tso much faster, Use tith
eres
es
parent $ locate file
5 rrythnbowclient next
ERC
natch, Ws good f
eee ae!
ae
or oieneet
amie
Current location
minal you might find yourselt 8
tle (ost in the Flesystom,
sy way to pipe your curert location
omething ese. You can print
salute ooation using pd
vant 9 quck
Move back through pushd
Following on rom Tip antto start
moving back up the stack tothe frst cirectory
You can use popd in the terminal. You can alsa
up by
chock which dir have eae
usingthe dirs comm
Process priorities
CPU prt for pro
igh
Priorty or #20 for owes
priority fram 0 to
ber Xs standing in for Ory sudo
or root ean alovat the erorty of a process, but
fnjonecansetone down thepronty chan,
Download via the terminal
mething via th
want 10 se th
take ary UBLyou epecity
IF you
Insert in
weet command kw
and downiosd it directly inte. your
nin the terminal (as long, a
permission te ao se). Use ke
$ wget http: //exanple.con/File.2ip
Move directories
moving between directore
might want beable to quiely ret
previous one that you were using. Instead
using €@ for moving 0
mnt use pushd to move ana erat
‘stack of directories to movebbetweerChange image formats
ead of loading up an image editor ike GIMP,
actualy change images in the terminal
using the convert command. You can very
to change the fletype oF even
72.Doitwith
simply use
canes the
$ convert image-jpg inage-pne
Alter image settings
As wel as convert 19 mogtly, which is
‘ctthesare sofa package. Youcan sat
orotate and do mare ta an mage mereeasly
than with some of te convert commands. To
$ mogrify resize 640x480! smage.one
Send message to displays
old school prank hat ean actualy have
ses viben done rig. Xmessage enables
you to send a message prom
the same system, as long asyou know thecisplay
youmantte send tt Ty
2 anxdiepiay 09
$ DISPLAYS nessage -center “Hello
Worle!”
Rename files with ep
This is an extension of the way you can use
op ~ ep will conya fie and name
you want, so you can either
directory and give ta deren
ust copy tint the same folder with a sifferen
name and olete the orignal. This aso works for
Manual. screenshots
odo during Raspberry
Ss, but it works everywhere else, Fo
NOME-based desktops you can do it in the
terminal by caling gnome-sereenshat. in XFCE
\s wfoe-screenshooter in LXOE Ws erat anc
000. Ths wil immediately take @soreenshot of
This is something w
Delayed screenshots
monu.or needtoposeashotin general Aofthe
screenshot tools allow you todelaybyading the
UAV SS
, Zags and other attempts by
vare engineers to be funny
ae
eee
corpubuntubstat- apt get noe
32)
“NN
oe
ee eee
ee eee eects
eu
ally write date nto the terminal
ne noes
erence
Cae iy
at
enter
are
ner
eee
eter
reenter
15 a Bash sort to simuiate
eno mae
Aer et
Pees sight vow,
at
oe