sis0i2024 Useful Intermediate Linux Commands | Linux | Maker Pro
‘Learn imortnt and helpful commands and programs fen executed by inermedise Linux users.
(Ceste Rainbow Colors wih an RGR LED and Netiaina
itpssimakorprofinundtutonaintermediatsinux-commands
18sis0i2024 Useful Intermediate Linux Commands | Linux | Maker Pro
Project,
etduin Pulss-Width-Modulation LED Pi
Project
Serle conse wih content
After you've goten familiar with Linux an eared Aow to se some asi commands, you might be asking yourself where you can go ftom thee. This ance will
cover afew more commands and prog that we often used whoa working with the Linx bush before inodueing you tothe concep of conctcaaing commands
‘nd redirecting ter inputs and ott which wil allow you to work even snore eft.
How to Copy Files Between Computers
Sep
scp stand for scate cops As the name suggests, this program allows youtotansfer files fom local machine to a eme computer and vice-versa. The flowing
command copies lea eto a emote comple
Use the following synae to tanser fle rm a remote computer your machine
This command is ncrediby afl when working with developer boar like the Ratphery Pi or BeagleBbone srs
weet
‘You san wie the wget command if you want to download a le from a server to your local computer:
B sonst a x
The command wil attempt o dawnload the resource you supplied and it wil autoraially detect the fe extension, For example; Ifyou point eto a website, i
download sn HTML fe If you're ansferng a linge ile, you en simply logout nd the tol wl Ssh he ask nthe ackeroun
How to Use Process Management
ps/top
The plop commands alow you to it the procesesruaing o your compe
[Not that this will only generate soups. You cn, however, et st tha eftehes te by using the op comaand
tps simakor profiruxdttoralintermediate-inux-commands 26sis0i2024 Useful Intermediate Linux Commands | Linux | Maker Pro
2
wilt
The kill command canbe used o end running task. You may waat to end a program thi’ ithe not responding or that’ ruming inthe background, Ether way,
you'll hve to find out the PID ofthe process (you can do tat with po op:
Fae
The verve ommand can bese to manage services on your compute. I's gute versie in away tha you can str, stop, and restart sericea well a print details
sands of all avaiable servies on your compute. To prin list use the folowing command:
To printa detailed stats ofa paricalar service, use:
For example:
a
As you ean se the sevice is curently running, Thal means we can stop or eta i To ei ype
tps simakor po
ruxdttonalintermediat-inux-commands
6sis0i2024 Useful Intermediate Linux Commands | Linux | Maker Pro
To end the sevice, replace restart with sop.
How to Mounting and Unmount USB Drives
sbi / fdisk
‘You can use the [sb and isk commands to list block devices (sbk) and to display and manipula disk prion fis). ter one will wok for this task,
Berar a
As you can sc, Izan the command before andar inserting a USB dive, Next tke note of the patton you'd like t9 mount. Tn my ese, thas da?
mount
‘Use this commana to mount the filesystem ofan external deve in your local ile system. This wll llow you to work withthe les onthe storage device
‘You can then aces the ile on the mounted patton by navigating to the nt folder
Umount
[Aeryou're done with he USB drive, you need o eject it, You san do that by ting the unmount command together withthe mounting point, you defined carer,
These commands ae just» smal percentage of what the Linux bash has to offer, Howes, fnd these o be paticuly use in every i, especialy when
‘working om a rmote computer via SSH ors headers stm.
How to Use Concatenating Commands
The tre power ofthe Linx shell does't come fiom using simple commands and programs. You cn sil et lot done like hat, bt to work even more efficiently and
fas, you can concatenate commands instead of wing fer one finish before ally typing inthe next one, Furthermore, you can file or store the results in fle
svi canbe handy in many ways
How to Filter Results
Some commands like ps or, can give you a very long is of resus. Usually, you're only interested in a particular entry a a set of entries (fr example all. py files in
folder) A conumand, that allows you to search for specific characters in asin, called rep. Iwill simply pital ines where the ting you've searched for
tps simakor po
ruxdttonalintermediat-inux-commands 48,sir0i2024 sel Intermediate Linux Commands | Linux | Maker Pro
Now, you'll anly ced to fod th ouput of program, fr example, echo o I, nto the ep comma as anit andl fier everything islevant, As you cose,
the pipe operator i used wo acomplish that Let's ut a8 example:
— 0
‘Pm only intrested inthe files that end with py. To apply a iter, fed the ouput fs int grep with iting regular expression
How to Run a Program in the Background
Someties you'd ke to exes a rogrim ht might ike a wile o comple but you don't want to wa frit is, You can ean ampere forth purpose
That will un nthe program in the background. When it stars, the PID ofthe new proces gets printed othe console an eveything the program outputs to stout,
wills get printed the console
How to Write to and Read From Files
‘The results of al programs thet ourpr to the stdout steam, canbe writen tothe programs or files. For example, if wanted to store thelist of python sripts in ile,
Teould do so by typing
tps simakor po
ruxdttonalintermediat-inux-commands
58sis0i2024 Useful Intermediate Linux Commands | Linux | Maker Pro
This wil create (or overwrite) a ile called pythons st that contains te results of the Is command ered by are. Ifyou don’t want to overwrite the contents of
tment le, you ean use >> to spend new text to it instead
It you wool to Grd the conten of fe tos prope, you can oe the < symbol
These operators will wits to the standad input stream andrea from the standard output ofa program respectively.
How to Run Multiple Commands at Once
Lets suppose you want to ran multiple commands that might tke a while to fish, But you don't want sit at your computer and wait for them to nish just so that
you ean enter the next command. Lc, you ea ener anc of nsritons lance and hey beexceuted near another wie you can enjoy a cfc bak
To accomplish tht, write all commands in one line and separate them with semicolons
Bu what ia comand fails? Or you only want to exocute a command once you canbe sue tht its predocossor was sucesafl? Those cats ar also covered
Ale
This will rn the command A and, iit fil, will xscue B The following snippet does he exact opposite,
his means, that B wil only ge executed when A wa sucessful That way, you can string together gsite complex commands tha slot ike smal applications
themselve
test 8 rm py-es. tet; Cou pyofSes. tat 48 1S 2 | grep "itipy$" 9> pytles. tet BA ano “rile ented! The contents ane aco
‘Which wil produce the following output:
tps simakor po
ruxdttonalintermediat-inux-commands 86