24
CHAPTER 1: LINUX OPERATING SYSTEM A bit of history What is Linux? A short answer to this question is "a computer operating system based on Linux kernel and GNU tools and libraries". In order to understand what Linux is, first we need to know different concepts such as Linux, kernel, and GNU. Formally, Linux is not an operating system. It's just a software component working as a bridge between applications and the data processing done by the hardware. Because of this fact, the kernel is the core component of an operating system. First Linux kernel was written by Linus Torvalds in 1991. Usually, the term Linux is used to refer to a whole operating system based on the kernel. However, an operating system needs more components to be complete. At this point, there are a number of operating system based on Linux kernel, plus a set of tools provided by the GNU open source project. What are GNU tools? Well, first of all we should learn about the GNU project. Basically, this is an open source project started by Richard Stallman with the goal of building a set of software components and tools to avoid the use of any software that is not free. Now that we've learned about Linux, kernel, and GNU, we can define a distribution as a composition of Linux kernel and GNU tools and other useful software. We've just mentioned a new concept—distribution. Have you heard about Ubuntu, Fedora, or Debian? These three are examples of Linux distributions. A Linux distribution can be defined as a whole operating system providing a kernel, a system of base tools, and a complete set of applications ready to use for users. This guide is based on Linux Mint, a distribution that started back in 2006 with a goal to be fully usable on the desktop computers. What is open source? Linux is an open source project supported by hundreds of volunteers and contributors. This means that people work together sharing ideas, writing tutorials, discussing in forums, and developing software. The final result is not only the Linux distribution, but a lot of documentation is generated as well. Collective intelligence allows us to build one of the most used operating systems in the world. We cannot forget that Linux operating system (OS) is open source, and it's released under the popular General Public License (GPL) software license. All people contributing to Linux project make up the community. In the open source world, a community is a set of users and developers supporting a specific project. Everyone can contribute to a Linux project in different ways and that's the magic of open source projects, where the job of each person matters. The first area is for those who want to develop software, write documentation, make artwork, or report bugs. However, non-technical people can contribute to this area as well, for instance, they can make translations to get more and more languages supported. The promotion of the project and distribution can be for those who are interested in helping others, writing articles, or organizing local presentation for spreading the knowledge. Linux mascot: Tux the penguin

CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

CHAPTER 1: LINUX OPERATING SYSTEM

A bit of history

What is Linux? A short answer to this question is "a computer operating system based onLinux kernel and GNU tools and libraries". In order to understand what Linux is, first we need toknow different concepts such as Linux, kernel, and GNU. Formally, Linux is not an operatingsystem. It's just a software component working as a bridge between applications and the dataprocessing done by the hardware. Because of this fact, the kernel is the core component of anoperating system. First Linux kernel was written by LinusTorvalds in 1991. Usually, the term Linux is used to refer to awhole operating system based on the kernel. However, anoperating system needs more components to be complete. At thispoint, there are a number of operating system based on Linuxkernel, plus a set of tools provided by the GNU open sourceproject.

What are GNU tools? Well, first of all we should learnabout the GNU project. Basically, this is an open source projectstarted by Richard Stallman with the goal of building a set ofsoftware components and tools to avoid the use of any softwarethat is not free. Now that we've learned about Linux, kernel, andGNU, we can define a distribution as a composition of Linuxkernel and GNU tools and other useful software. We've justmentioned a new concept—distribution. Have you heard aboutUbuntu, Fedora, or Debian? These three are examples of Linuxdistributions. A Linux distribution can be defined as a whole operating system providing a kernel, asystem of base tools, and a complete set of applications ready to use for users. This guide is basedon Linux Mint, a distribution that started back in 2006 with a goal to be fully usable on the desktopcomputers.

What is open source?

Linux is an open source project supported by hundreds of volunteers and contributors. Thismeans that people work together sharing ideas, writing tutorials, discussing in forums, anddeveloping software. The final result is not only the Linux distribution, but a lot of documentation isgenerated as well. Collective intelligence allows us to build one of the most used operating systemsin the world. We cannot forget that Linux operating system (OS) is open source, and it's releasedunder the popular General Public License (GPL) software license. All people contributing to Linuxproject make up the community.

In the open source world, a community is a set of users and developers supporting a specificproject. Everyone can contribute to a Linux project in different ways and that's the magic of opensource projects, where the job of each person matters. The first area is for those who want todevelop software, write documentation, make artwork, or report bugs. However, non-technicalpeople can contribute to this area as well, for instance, they can make translations to get more andmore languages supported. The promotion of the project and distribution can be for those who areinterested in helping others, writing articles, or organizing local presentation for spreading theknowledge.

Linux mascot: Tux the penguin

Page 2: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

CHAPTER 2: INSTALLING LINUX MINT

Boot process, partitions and mounting

A typicall boot process of every operating system consist of a few steps:

Majority of Linux distributions use a boot loader named GRUB (Grand Unified Boot Loader)which handles booting different OSes from different hard drives, partitions and file systems. Bootloader is a piece of software usually installed in the first 512KB of the Master Boot Record (MBR)on the first hard drive. As you know, hard drives are divided into partitions and each partition uses afile system. Linux OSes name physical hard drives as SDA, SDB, SDC and so on, where SDA isthe first physical disk, SDB is the second physical disk etc. “S” in the name stands for SATA, “D”for the disk. When we add partitions to the mix numbers are added. So, the first partition on the firsthard drive is SDA1, second partition will be named SDA2 and so on. Following this conventionyou can easily know that the fourth partition on the third disk will be named SDC4.

All partitions are attached to the system via a mount point. The mount point defines theplace of a particular data set in the file system. Mount points are directories. These emptydirectories will be the starting point of the partitions that are attached to them.

Linux distributions also use a different partition mounting scheme than Windows. In aWindows installation you typically have C and D partitions; first one for the OS itself, and thesecond for user data. Linux installation also uses two partitions. Root partition, mounted to / , iswhere the system is installed, while the other partition which is mounted to /home is the place foreach users data files and software preferences. In addition to root and home partitions, sometimes aswap partition is needed, typically for systems with 1GB or less of RAM. Swap partition is used asa virtual memory when the OS runs out of physical RAM. On Windows OSes this is known as thepage file.

Windows Linux

Physical location Name Mount point Name Mount point

First hard drive, first partition disk(0)rdisk(0)partition(1) C sda1 /

First hard drive, second partition disk(0)rdisk(0)partition(2) D sda2 /home

Comparison between Windows and Linux HDD naming schema

A file system is used to control how data is stored and retrieved. Without a file system,information placed on a hard disk would be one large body of data with no way to tell where onepiece of information stops and the next begins. By separating the data into individual pieces, andgiving each piece a name, the information is easily separated and identified. Windows typically usesNTFS and FAT32 file systems, depending on the size of the disk. Linux supports a wide range offile systems, some of which are used more often than the others. Most widely used file system onLinux is EXT4, preceded by EXT3. Future kernel version feature a new file system called BTRFSwith some advanced algorithms and techniques for storing and retrieving data.

Page 3: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Editions

As other operating systems, Linux Mint has different editions orflavors. Basically, we can find two main editions—one based on Debian,which is called Linux Mint Debian Edition (LMDE), and another onebased in Ubuntu. In addition to Ubuntu and Debian software repositories,Linux Mint uses its specific ones. LMDE is a rolling release. This meansthe distro constantly receives updates without generating releases.However, releases for the regular Mint edition (the one based on Ubuntuwhich we will use) are only generated by following a specific period oftime. Despite LMDE being faster and more responsive than Linux Mint,non-advanced users should think again before using it because continuousupdates can bring some errors that they might find difficult to solve.

On the other hand, Linux Mint is easy to maintain and was designed to offer an unbeatableuser experience.The Linux Mint project distributes each edition through different ISO images, eachbeing ready to be burned on a DVD. Regarding the regular edition of Linux Mint, we can find eightdifferent ISO images. Well, we only have four that are really different, because each one has its ownequivalent in 32b and 64b. Four different desktop environments are included—MATE, Cinnamon,KDE, and Xfce. This guide will focus on Linux Mint 64bit with Cinnamon desktop environment.

Hardware requirements

Device Minimum Optimal

CPU 1GHz 32bit 1GHz 32bit

RAM 512MB 1GB

HDD 8GB 8GB

VGA 2D, 800 x 600 resolution 3D, 1024 x 768 resolution

Creating a bootable USB drive

1. Download Linux Mint 16 from this link: goo.gl/Z3XIPW

2. Download Unetbootin from this link: unetbootin.sourceforge.net

3. Open Unetbootin, choose Diskimage and browse to downloadedISO file

4. Choose your USB drive carefullyand click OK. After a few minutesUSB drive will be ready andbootable

Linux Mint logo

Page 4: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Installation

1. Reboot your computer and select your USB drive as the device for booting.

2. After boot you should see a screen like this. Press Enter and allow it to finish booting

3. After bootup is finished you should see a desktop like this. Linux Mint is usable as aLiveCD which means it can be used directly from USB or CD drive without installation.LiveCDs are usefull when you have a non working hard disk or a faulty Windowsinstallation to recover your files.

Page 5: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

4. Double click “Install Linux Mint” icon and choose your language options

5. Next screen will make sure that your computer can install and run Linux Mint

Page 6: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

6. This screen lets you choose installation type. First option will erase your entire HDD andautomatically create partitions. We don't want that, so choose “Something else” which letsyou create the partitions manually

7. On this screen choose “New partition table” and proceed with “Continue” when prompted.Create two partitions as noted in the introduction: one for the system (root partition) and onefor user data (home partition) like in the picture below. Note the boot loader installation pathis /dev/sda which is the MBR of the first hard drive

Page 7: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

8. Next screen will automatically set your timezone, change if needed

9. After time zone, choose your keyboard layout, as in the picture below

Page 8: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

10. Last step allows you to enter your name, username and your password

After a few minutes the setup will finish installing Linux Mint and offer you to restart your system.Boot from the first hard drive and choose “Linux Mint” from the GRUB boot loader. Login screenwill prompt for your password

Page 9: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

CHAPTER 3: CONFIGURING LINUX MINT

The Control Center

Control Center is an integrated software tool that provides access to many usefulapplications for configuring different aspects of your operating system, like the Control Panel onWindows. The tools are grouped into different sections, namely “Appearance”, “Preferences”,“Hardware” and “Administration”. To access it, click the Menu button and then click SystemSettings in the upper left portion of the menu.

Page 10: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Changing display resolution

Open the Control Center and type “resolution” in the search box in the upper right corner, then click the Display icon and confirm with Apply.

Wired network settings

Nowadays, computers work together through network-sharing resources such as files,folders, and printers. In fact, the Internet is a huge network where computers are working toexchange data. In order to be able to participate in this exchange an IP address is needed. There aretwo ways to get an IP address – automatically by using a DHCP server, and manually. Letsconfigure our network for automatic IP address:

1. From Control Center open Networking

2. Open Wired network options and navigate to IPv4 settings

3. Set Method to Automatic (DHCP)

Page 11: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Your computer will be assigned a new IP address from a local pool of available addresses when anetwork is configured in this way.

Wireless network settings

Confguring a wireless network is very similar to wired network configuration with somesecurity settings added.. These are accessed by clicking 802.1x Security tab and choosing theapropriate security method such as WPA2. Be sure to configure your wireless router in the sameway.

Sharing resources with Windows users

Shared resources, also known as network resources, refer to computer data, information, orhardware devices that can be easily accessed from a remote computer through a local area network(LAN). When resources are shared over a network, users can use them as if those resources were ontheir own computer. The most frequently used shared network environment objects are files, data,multimedia and hardware resources like printers and scanners. Sharing resources over networkbetween Linux and Windows machines works over SMB protocol (pronounced Samba). Samba isofficially supported on every Linux distribution, various UNIX distributions and Windows sinceWindows Millenium. Since version 4 Samba can act as a primary or secondary domain controller inan Active Directory environment.

To access a Windows share on your network, open the Nemo file manager and locateNetwork section in the Locations pane on the lower left:

Page 12: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

A prompt will ask for a password of the user account on the Windows machine. Password must beenabled for that account if the account is administrative. You can see all the shares enabled on theWindows machine when you enter the right password.

Changing your password

When an administrative user creates a user account that account will not be assigned apassword. In order to prevent everyone from logging into your account you should change yourpassword. To change your password open the Control Center, click Account details and then clickthe password field. Another window will open requiring you to enter the current password and thenew password twice.

Page 13: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

CHAPTER 4: USER AND GROUP MANAGEMENT

Who am I?

A user account is required for accessing Linux Mint. Actually, when you installed theoperating system you typed some data about a user and the account was created. Sometimes it isneeded to add or remove a user, or become another user with elevated privileges. This chapter willexplain how to add or remove users, manage user privileges and become the super user.

Users

Linux was built as a multiuser operating system. Each Linux distribution has at least twousers by default, a regular user and a super user called root. This is a special user of the operatingsystem that is used by the system administrator. The root user has all kinds of permissions over filesand programs. Actually, some specific operations can only be executed through this user. LinuxMint doesn't enable the root user by default. However, Mint uses special commands that allow usersto become the root user. This means that regular users can execute actions that were initiallyreserved for the root user. Also, Mint configures the sudo command (super user do), allowing theuser created during the installation process to become the root user. You were doing some actions asthe root user in the previous chapter while installing and removing packages. That is why you hadto input the password before executing any action that would alter the system.

Adding a user

As we said before, Linux was built as a multiuser operating system where each user has a setof permissions over files and directories. Lets add another user account. Click the Menu button andtype “users” in the search box. Search results will offer you to run Users and groups application.Run it, type your password and click the Add button to add another user account.

Page 14: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

There are two types of user accounts on Linux Mint, standard and administrator. A standarduser can't use sudo privileges while an administrator user can. The first user created during theinstallation is an administrator user. Now, add a standard user with a password.

Adding a new group

On Linux systems, users can be categorized into groups. A group is a set of users who sharepermissions. For example, a specific group can have access to certain directories. This means thatall users belonging to that group can access these specific directories. Linux Mint uses many groupsby default; some of them are audio, backup, and games. Also, it's possible to create additionalcustom groups. The window for creating a new group allows us to choose a group name. Everygroup on Linux systems has an ID number which identifies each group and must be different foreach group created in the system. Linux Mint will choose a group ID by default for every newgroup, but you can choose a different number as well. Let's add a group using the same tool we usedfor adding users as seen in this picture. Click the Groups tab and then click the Add buton. A smalldialog will appear asking for the name of the new group. Type “pravnici” and click Ok.Adding auser to a group

Users and groups window allows us to add a user to a group. Select the user named“Marica” and click the Groups button to display a list of all groups to which “Marica” belongs to.Creating the group will automatically create the group with the same name, so the user “Marica”will be a member of the group named “marica”. Check the boxes like in the picture below to adduser Marica to groups “pravnici” and “sudo”.

Page 15: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Adding this user to the “sudo” group effectively makes the user an administrator. Be carefull aboutthis, not everyone should be allowed to change the system configuration.

CHAPTER 5: INSTALLING, REMOVING AND UPGRADING SOFTWARE

Installing software

Sooner or later, you will want to install some additional software. In fact, this is one of themost common tasks for the users. Linux Mint includes thousands of software applications that canbe installed easily. Remember that when you install the operating system, a lot of software isinstalled by default. Also, it's possible to install additional software provided by Linux Mint. Inorder to facilitate the process of installing software in Linux Mint, this operating system includes atool named Software manager. Click the menu button in bottom left corner, hover toAdministration and select Software manager as shown in the picture below.

Authentication is required in order to run an application that will alter the operating system itself,such as installing or removing software. When you run Software manager a password prompt willappear. Enter your password that you chose while installing. If you entered the password correctly awindow will open like the one in the picture above.

Running Software manager

Page 16: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Linux Mint comes with default applications for internet, multimedia, office and graphicsinstalled. Let's install SMPlayer instead of default VLC Media Player. Locate the search field in theupper right corner of Software manager and type “smplayer”. After a few moments a list will appearcontaining every software package related to the search term.

Software manager search results

Page 17: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Double click the first item as shown in the picture above, after which info page appears.

Clicking “Install” will download and install SMPlayer.

Page 18: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Linux distributions include a lot of software that is ready to be installed in a specific formatcalled a package. Software is organized in different packages and some applications need more thanone package; this fact is called package dependency. Linux Mint uses packages in the Debian(DEB) format, same as the Ubuntu Linux and Debian operating systems. Packages are usuallyretrieved and installed from an internet location. This location is called a repository, and it containsmany software packages ready to be downloaded and installed in your machine. Software Manageris an application developed by Linux Mint developers specifically for Linux Mint. This tool allowsyou to list, install, and remove software. Technically, Software Manager is a frontend for somecommands, such as apt-get and apt-cache. Using a GUI, Software Manager provides an easy andintuitive way to list, install, and remove software, avoiding the use of the command-line interface.

We've installed SMPlayer, a simple but powerfull multimedia player. As you must havediscovered, it's pretty easy to install software through packages provided by Linux Mint. You onlyneed to search for a software package and click on the Install button. Obviously, you can install a lotof different software on your machine following the same process. It's important to know that notonly software distributed in packages can be installed in Linux Mint. However, Mint includes a lotof software distributed in DEB packages, so this method of installation is advisable. Actually, it'sgood practice to use Software Manager to install software on your Linux Mint operating system.Have a go – discover software provided by Linux Mint. When you launch Software Manager, awindow showing you different icons will be displayed. Each icon represents a different category ofsoftware included in Linux Mint. For example,you can see the Internet, Sound and Video, Graphics,and Office categories, among others. By clicking on each one, you'll have access to packagesbelonging to the selected category. You can try and click on a category, take a look at the list ofpackages for that category, and try to install one of the packages. This process allows you todiscover interesting software that can be installed on your machine.

Removing software

Previously, we learned how to install software on your Linux Mint machine. Also, it'sinteresting and useful to know how to do the opposite step. You can remove installed software onyour machine by following a simple process using the Software Manager tool. Remember that youcan remove software installed by default during the installation process of the operating system orremove software that you have installed through the Software Manager application.

Similarily to the previous process, open Software manager, search for VLC, double click thefirst item and click “Remove” button.

Updating software

Between the release cycles, Linux Mint developers update some software that is included inthe operating system. This means that the user should check what software has been updated andthey should decide which of this software should be installed on the machine. Occasionally, updatedsoftware only applies minor changes, such assimple improvements or unimportant bug fixes.However, at times updated software alsoincludes important security bug fixes. If we don'tapply them, our machine can be at a serious risk.That's the reason we frequently check whichsoftware has been updated for our Linux Mint.

Page 19: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Update Manager is an effective application provided by Linux Mint to install new versionsof installed software and to install security updates on your machine. When you launch thatapplication the first time, you will see only a single item in a list for applying upgrades. This itemindicates that you need to install an upgrade for “mintupdate”, which is the codename of UpdateManager. Obviously, before applying other upgrades, we need to upgrade the tool itself. Once thisprocess is finished, Update Manager will be launched again to check which software can beupdated.

The list of software ready to be updated displays different items providing information aboutthe package name, installed version, and new version available. Also, a number for each item isdisplayed. This number ranges from 1 to 5, and it indicates a level based on the importance of theupgrade. Level 1 indicates that Linux Mint developers certify that a package and packages markedwith this level should be upgraded as soon as possible. Usually, security updates use this level. Thenext level is for those packages whose upgrade is recommended by Linux Mint developers. Level 3indicates that it is safe to apply an upgrade, but Linux Mint developers didn't test it. Packagesmarked with level 4 are unsafe, and if you upgrade it, the stability of the system can be affected.Finally, level 5 is for dangerous packages (in the unstable stage of development or with brokendependencies), and Linux Mint developers know that they can damage the operating system.

In general terms, it's a good idea to launch the Software Manager frequently and upgradeonly those packages marked as level 1 and level 2. For levels 3, 4, and 5, system administrators andadvanced users should decide about applying upgrades or not themselves. Also, you can mark allthe packages listed or only a few of them. By default, only packages from level 1 to 3 are displayedin the list for upgrading. You can change this preference by going to Edit | Preferences.

To update your system follow these simple steps:

1. Run Update manager by clicking on Menu, hovering over Administration and clickingUpdate manager in the right pane

2. Enter your password to authenticate and change the system configuration

3. After the initial refresh, click “Install updates” to update the “mintupdate” package

4. A list of all packages that can be updated will be shown after updating “mintupdate” Again,click “Install updates” to update the whole system.

Page 20: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

CHAPTER 6: COMMAND LINE INTERFACE

Introduction to the command line

A command-line interface, also known as command-line user interface is a means ofinteracting with a computer program where the user issues commands to the program in the form oflines of text (command lines). Command-line interfaces are often preferred by more advancedcomputer users, as they often provide a more concise and powerful means to control a program oroperating system. Programs with command-line interfaces are generally easier to automate viascripting.

Operating system (OS) command line interfaces are usually distinct programs supplied withthe operating system. A program that implements such a text interface is often called a command-line interpreter or shell. The term 'shell' can be in principle any program that constitutes the user-interface, including fully graphically oriented ones—for example, the default Windows GUI iscreated by a shell program named explorer.exe. Examples of command-line interpreters include thevarious Unix shells (sh, ksh, csh, tcsh, bash, etc.), the historical DOS command.com and theWindows cmd.exe programs.

Anatomy of a command line

Every command line interface, or the shell, consists of two components. First part is theprompt and the second part are user entered commands. In a Windows environment a prompt isusually the current directory, for example C:\. On Linux systems this prompt is similar touser@hostname$ (that's how email addresses were created), for example ivica@mintbox. As youcan see, this prompt consist of currently logged in user followed by the machine hostname. Dollarsign means that the user is a regular user and not the root user. Root users have their commandprompt followed by #, for example root@mintbox#.

Executing commands

Linux Mint provides an easy to use shell interpreter called the Terminal. Launch it and note the prompt, similar to the one in the picture:

Page 21: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Tips and tricks

It is valuable to know a few things before adventuring into shell commands and scripting:

1. Linux is case sensitive; documents is not the same as Documents

2. TAB key is very useful because it completes commands, including programs, directory orfile names. Just type a few starting letters and press TAB. For example, if there are multiplecommands starting with “to” like touch and totem then press TAB twice to see all thesuggestions.

Moving around the directory tree

Shell can sometimes be hard to comprehend and to navigate, so it is usefull to know wherewe are now in the directory tree. Printing the current working directory is done by executing pwd(print working directory). Output should be similar to

ivica@ivica-VirtualBox ~ $ pwd

/home/ivica

which represents the user's home directory. To change the current directory simply type

ivica@ivica-VirtualBox ~ $ cd Documents

ivica@ivica-VirtualBox ~/Documents $

cd stands for change directory. Notice how commands are abbreviated from the actions themselves?If you are to type pwd now and check the current working directory, this would print out:

ivica@ivica-VirtualBox ~/ Documents $ pwd

/home/ivica/ Documents

Notice that the prompt changed – it now includes the name of the current working directory,Documents. In addition to it, there is an ~ simbol (tilda). This symbol represents the user's homedirectory and is widely used whenever possible. For example, if you are on some long path like/home/ivica/some/long/path/to/a/directory and want to go back to your home directory simply typecd ~ and it will return you there. If you wanted to go back just one directory cd .. (note the twodots) will do that for you. Going two directories back is done by executing cd ../.. and so on.

Creating directories and files

Creating a new directory is easy. Let us create a new directory called “podaci”:

ivica@ivica-VirtualBox ~ $ mkdir podaci

mkdir stands for make directory. It is also possible to create new directories on a path, like this:

ivica@ivica-VirtualBox ~ $ mkdir -p slike/nove

Page 22: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

This command will act in two ways:

1. if the directory “slike” exists, the subdirectory “nove” will be created;

2. if the directory “slike” does not exist, it will be created, followed by creation of thesubdirectory “nove”;

To create a text file use the touch command:

ivica@ivica-VirtualBox ~ $ touch fajl.txt

Listing directories and files

To list directories in the current working directory run the ls command, which stands for“list”:

ivica@ivica-VirtualBox ~ $ ls

Desktop Downloads Pictures Public Videos

Documents Music podaci Templates

The ls is a simple listing which shows only the name of the files and directories which are nothidden. To show hidden files and directories add the -a command switch. Note that hiddendirectories have a dot in front of the name, .dbus for example.

ivica@ivica-VirtualBox ~ $ ls -a

.dbus .gksu.lock Pictures .vboxclient-clipboard.pid

Desktop . gnome2 podaci .vboxclient-display.pid

.bash_history .dmrc .ICEauthority .profile

Use the cat command to view the contents of a text file:

ivica@ivica-VirtualBox ~ $ cat fajl.txt

Ovo je rečenica iz fajla "fajl.txt".

Deleting directories and files

So far we have created and listed directories and files from the command line. Deleteingfiles and directories is equally simple as creating them. Command rm which stands for “remove”will remove any file. Let's delete a file named “fajl.txt” to see rm in action:

ivica@ivica-VirtualBox ~ $ rm fajl.txt

There was no output from the shell which means that the fajl was deleted successfully. If we were torepeat that command now it would throw an error that the file is missing:

ivica@ivica-VirtualBox ~ $ rm fajl.txt

rm: cannot remove ‘fajl.txt’: No such file or directory

Page 23: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Most Linux shell commands also accept wildcards such as asterisk (*) or a question mark (?). Anasterisk replaces any number of characters. We have a directory with many different files, as seenby executing ls:

ivica@ivica-VirtualBox ~/podaci $ ls

slika2.jpg slika5.jpg tekst11.txt tekst1.txt tekst4.txt

slika3.jpg slika6.jpg tekst12.txt tekst2.txt tekst5.txt

slika4.jpg tekst10.txt tekst13.txt tekst3.txt tekst6.txt

To delete all the pictures from a directory in bulk (not one by one) you would simply execute:

rm *.jpg

This command can be loosely translated as “delete every file with any name that has any number ofcharacters if the extension is jpg”. Listing the files again will show that only pictures were deleted:

ivica@ivica-VirtualBox ~/podaci $ ls

tekst10.txt tekst12.txt tekst1.txt tekst3.txt tekst5.txt

tekst11.txt tekst13.txt tekst2.txt tekst4.txt tekst6.txt

Another wildcard, a question mark, is used to replace exactly one character. A simple examplewould be to delete the files that have a name with two digits in it, namely “tekst10.txt, tekst11.txt”and so on.

ivica@ivica-VirtualBox ~/podaci $ rm tekst1?.txt

The command shown above would delete files “tekst10.txt tekst12.txt tekst11.txt tekst13.txt”.

Directories can be deleted in a similar manner, except for when they are not empty. Non emptydirectories must be deleted recursively, i.e. from the bottom of the directory tree up – from last fileup to the directory itself. This can be done with passing an extra argument to the rm command:

ivica@ivica-VirtualBox ~ $ rm podaci/

rm: cannot remove ‘podaci’: Is a directory

When we add the -r argument the directory will be deleted:

ivica@ivica-VirtualBox ~ $ rm -r podaci/

Again, there was no output which means that there was no error and the command executedsuccessfully.

Page 24: CHAPTER 1: LINUX OPERATING SYSTEMvtsns.edu.rs/wp-content/uploads/2014/05/Linux-VTŠ-vežbe... · 2014. 5. 9. · CHAPTER 2: INSTALLING LINUX MINT Boot process, partitions and mounting

Copying, moving and renaming files and directories

In order to copy a file you need to provide it's source and destination path to the cpcommand. Since the file “nova_slika.jpg” is in the current directory we just have to type it's nameand add the destination which in this case is the directory “slike”:

ivica@ivica-VirtualBox ~ $ cp nova_slika.jpg slike/

No output indicates that the picture was successfully copied. To copy a directory you must add arecursion argument, -r to copy the directory with all the files in it.

ivica@ivica-VirtualBox ~ $ cp -r nove slike slike/

Moving and renaming files shares the same syntax, and if you think about it it makes sense.Command that is used is mv, short for “move”. Source and destination are required, as withcopying. There is a directory named “podaci” in the current directory. Let's change it's name to“tekstovi”:

ivica@ivica-VirtualBox ~ $ mv podaci/ tekstovi

ivica@ivica-VirtualBox ~ $ ls

Desktop Downloads Public tekstovi Videos

Summary of commands used in this chapter

Action Command Usage Example usage

Show current directory pwd pwd pwd

Change directory cd cd directory name cd Documents

Create a directory mkdir mkdir directory name mkdir slike

Create a file touch touch file name touch imenik.txt

List directory ls ls directory name ls slike/

Show file contents cat cat file name cat fajl.txt

Delete a file rm rm file name rm fajl.txt

Delete a directory rm -r rm directory name rm -r Documents

Copy a file cp cp source destination cp nova_slika.jpg slike/

Move a file mv mv source destination mv nova_slika.jpg slike/

Copy a directory cp -r cp -r source destination cp -r slike/ Documents

Move a directory mv mv source destination mv podaci/ slike/

Rename a file or directory mv mv old-name new-name mv podaci/ tekstovi/