02 Eng

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Machine Translated by Google

Bash ukazi, use terminala in ds9


Dunja Fabjan
Faculty of Mathematics and Physics Ljubljana 25./27.
10. 2021

In this part, you will learn the basic commands of the Bash language. We will use the computers in the computer classroom.

We will use the Debian operating system on the computer. The choice is made as soon as we turn on the computer, where we select
the Debian environment and press the Enter key .

On the screen, we have a menu at the top left, through which we access the programs, and in the lower part there are some icons.
Among them, we will use the icon with a black screen (terminal). Among the programs, we will look for a web browser (Application >
Internet > Firefox or another browser of your choice).

In the terminal, we'll take a quick look at Bash commands, which are described in more detail in Introduction to Bash, which you can
find on the course's website:

• check where we are with the command

pwd

which we enter in the terminal and press the Enter key . The address of the folder where we are located will be displayed in
the terminal:

/home/username

• check which files are present in the folder with the command:

ls

which means sheet... In this case, only the list of folders and files (if they are present) is printed. Various options can be added
to commands. As an example of the ls command, we can write:

ls -l

ls -lr

ls -lrt

ls -lrth
ÿ

• move to the Pictures folder. If we are in the folder /home/username, just write it

cd Pictures/

in the opposite case, write the full address:

cd /home/username/Pictures/

• we will save the image from the web. In the web browser, find the website Astronomical pictures of the day (https://apod.fmf.uni-
lj.si) and click on the picture. Highlight the address and press CTRL + C to save the link to the clipboard ,

• We open the terminal again, where we write the command wget and copy the web address of the image

wget https://apod.fmf.uni-lj.si/image/2110/MonumentValleyRoad_Abramyan_2048.jpg

(the image changes daily, so your link will be different)

• We open the image and examine it with the Gimp program, which we start from the command line:

1
Machine Translated by Google

gimp MonumentValleyRoad_Abramyan_2048.jpg

In such a case, we ran the program in the command line and until the program is stopped (closed), the terminal is locked. Whatever
ÿ

we write in it will not be executed. But if we want to run the program from the command line and move it to the background (thus freeing
up the command line), write:

gimp MonumentValleyRoad_Abramyan_2048.jpg &

• Let's create a new folder:

mkdir APOD

and verify that it is indeed located in /home/username/Pictures/ with the ls command. What happens if we want to create another folder
called Astronomical Image? Check what happens if you write:

mkdir Astronomical image

We created two folders, Astronomy and Image, instead of a single folder. This is because the mkdir command does not understand a
space as part of a full name. In case we would like to have the full name, we will enter:

mkdir Astronomical\ image

In this case, the command will build the Astronomical Image folder.

• Let's remove the folder. Folders can be removed using the command

rmdir Astronomical rmdir


image/

• Create a copy of the document in another folder. We will copy the image we downloaded from the web into the folder
Astronomical image.

cp MonumentValleyRoad_Abramyan_2048.jpg Astronomska\ slika/

Let's check if the folder contains an image:

cd Astronomical\ picture/
ls -l

• We return to the previous folder.

cd ..

command will take us to the folder containing the Astronomical Image folder. But where do we find ourselves if we just write the
command

cd

In this case, the command brings us to the initial folder, usually by default it is set to the home folder /home/username.

• Let's move to the Pictures folder with the command

cd /home/username/Pictures

• Remove the Astronomical Image folder.

rm -r Astronomical\ image
ÿ

Addendum 1: If you want, you can create shortcuts for frequently used commands to reduce typing in the terminal. For example, if you
want .bashrc

2
Machine Translated by Google

Appendix 2: You can look at the user help for each command. It is enough to write the command man and the command you are
interested in in the terminal, for example:

man ssh

You move in the display by pressing the long key, and to return to the command line, press the q key .

• We move the file to the folder.

mv MonumentValleyRoad_Abramyan_2048.jpg APOD/

and check the presence with the command:

ls -l APOD/

• Change the file access options.

chmod u+x MonumentValleyRoad_Abramyan_2048.jpg chmod ux


MonumentValleyRoad_Abramyan_2048.jpg chmod ugo+x
MonumentValleyRoad_Abramyan_2048.jpg chmod ugo-x
MonumentValleyRoad_Abramyan_2048.jpg chmod 777
MonumentValleyRoad_Abramyan_2048.jpg man chmod

• Close the terminal with the command:

exit

You might also like