INSTITUTE OF AGA LINUX LPI 5TH STAGE LECTURER: NIYAZ M. SALIH

Size: px
Start display at page:

Download "INSTITUTE OF AGA LINUX LPI 5TH STAGE LECTURER: NIYAZ M. SALIH"

Transcription

1 INSTITUTE OF AGA LINUX LPI 5TH STAGE LECTURER: NIYAZ M. SALIH

2 Chapter 1. Operating System Operating System: An Operating System, or OS, is low-level software that enables a user and higher-level application software to interact with a computer s hardware and the data and other programs stored on the computer. The main functions of operating systems are: -Program creation -Program execution -Input/Output operations -Error detection Institute of Aga Linux LPI Niyaz M. Salih (1)

3 Characteristics of Linux Multi-user A multi-user operating system allows for multiple users to use the same computer at the same time and/or different times. Multiprocessing An operating system capable of supporting and utilizing more than one computer processor. Multitasking An operating system that is capable of allowing multiple software processes to run at the same time. Multithreading Operating systems that allow different parts of a software program to run concurrently. Linux: Open source code OS and it is freely available to everyone. GUI operating system, including many of the tools that Windows users are familiar with such as, -A file manager -A Window manager -A help system -A configuration. Open source means any developer can customize code to create Linux OS. Institute of Aga Linux LPI Niyaz M. Salih (2)

4 Distribution packages Since Linux is open source. Lots of communities and companies made specific Operating system by using Linux. These specific operating systems are known as distribution of Linux. Some of them are free (community developed) and few are paid also. Following are few popular Linux distributions: -CentOS -Fedora -Suse Linux -Ubuntu -Red Hat Enterprise Linux Ubuntu Distribution Ubuntu is an ancient African word meaning humanity to others. It also means I am what I am because of who we all are. The Ubuntu operating system brings the spirit of Ubuntu to the world of computers. Institute of Aga Linux LPI Niyaz M. Salih (3)

5 Ubuntu desktop operating system powers millions of PCs and laptops around the world. Complete Open source Secure Accessible Complete Ubuntu comes with everything you need to run your organization, school, home or enterprise. All the essential applications, like an office suite, browsers, and media apps come pre-installed and thousands more games and applications are available in the Ubuntu Software Centre Open Source Ubuntu has always been free to download, use and share. We believe in the power of open source software; Ubuntu could not exist without its worldwide community of voluntary developers. Secure With a built-in firewall and virus protection software, Ubuntu is one of the most secure operating systems around. And the long-term support releases give you five years of security patches and updates. Accessible Computing is for everyone regardless of nationality, gender or disability. Ubuntu is fully translated into over 50 languages and includes essential assistive technologies. Institute of Aga Linux LPI Niyaz M. Salih (4)

6 Chapter 2. Linux Distribution & Architecture Linux Distribution RED HAT LINUX One of the original Linux distribution. The commercial, non-free version is Red Hat Enterprise Linux, which is aimed at big companies using Linux servers and desktops in a big way Free version: Fedora Project DEBIAN GNU/LINUX A free software distribution. Popular for use on servers. However, Debian is not what many would consider a distribution for beginners, as it's not designed with ease of use in mind. Institute of Aga Linux LPI Niyaz M. Salih (5)

7 GENTOO LINUX Gentoo is a specialty distribution meant for programmers. SUSE LINUX SUSE was recently purchased by Novell. This distribution is primarily available for pay because it contains many commercial programs, although there's a stripped-down free version that you can download. MANDRAKE LINUX Mandrake is perhaps strongest on the desktop, originally based off of Red Hat Linux. LINUX SYSTEM ARCHITECTURE Institute of Aga Linux LPI Niyaz M. Salih (6)

8 Linux System Architecture is consists of following layers: Hardware layer - Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc). Kernel - Core component of Operating System, interacts directly with hardware, provides low level services to upper layer components. Shell - An interface to kernel, hiding complexity of kernel's functions from users. Utilities - Utility programs giving user most of the functionalities of an operating systems. Institute of Aga Linux LPI Niyaz M. Salih (7)

9 Chapter 3. Linux Terminology Linux Terminology Kernel Distribution Boot Loader Service File System X Window System Desktop Environment Command Line Kernel The kernel is considered the brain of the Linux OS. It controls the hardware and makes the hardware interact with the application. Institute of Aga Linux LPI Niyaz M. Salih (8)

10 Distribution A distribution also known as Distros is a collection of programs combined with the Linux kernel to make up a Linux-based OS Bootloader Bootloader are used to boot other operating systems, usually each operating system has a set of bootloaders specific for it. Bootloaders usually contain several ways to boot the OS kernel and also contain commands for debugging and/or modifying the kernel environment. Service A service is a program that runs as a Background process. File system A file system is a method for storing and organizing files in Linux. Some examples of file systems are ext3,ext4,fat,xfs and Btrfs. X Windows System The X Windows System provides the standard toolkit and protocol to build graphical user interfaces on nearly all Linux systems. Institute of Aga Linux LPI Niyaz M. Salih (9)

11 Desktop environment The desktop environment is a graphical interface on top of the OS GNOME, KDE, Xfce and Fluxbox Command line Command line is an interface for typing commands on top the OS Institute of Aga Linux LPI Niyaz M. Salih (10)

12 Chapter 4. Man Pages man $command Type man followed by a command (for which you want help) and start reading. Press q to quit the manpage. Some man pages contain examples (near the end). man $configfile Most configuration files have their own manual. man $daemon This is also true for most daemons (background programs) on your system.. Institute of Aga Linux LPI Niyaz M. Salih (11)

13 man -k (apropos) man -k (or apropos) shows a list of man pages containing a string. whatis To see just the description of a manual page, use whatis followed by a string. whereis The location of a manpage can be revealed with whereis. Institute of Aga Linux LPI Niyaz M. Salih (12)

14 man sections By now you will have noticed the numbers between the round brackets. man man will explain to you that these are section numbers. Executable programs and shell commands reside in section one. 1 User Commands Programs and applications useful to the average user. There is usually one entry for each command and/or group of related commands. 2 System Calls Programming interfaces to the operating system itself. These are C calls that control the allocation and use of system resources. 3 Libraries Programming subroutines. Every C library function from standards like printf through the most obscure X Windows call belongs here. If other languages are installed. 4 Devices and Special Files System resources such as memory, hard disks, graphics displays, etc., are referred to as devices. 5 File Formats This section primarily describes the formats of operating system related files. Formats for application data files. 6 Games Manual pages for most games, demonstrations, and other "non-productive" programs are usually listed here. 7 Miscellaneous A few random bits that don't go anywhere else. Mostly text processing macro sets. 8 System Administration These pages describe all of the various programs, utilities, daemons, and a few of the concepts that make the system run. Institute of Aga Linux LPI Niyaz M. Salih (13)

15 man $section $file Therefore, when referring to the man page of the passwd command, you will see it written as passwd(1); when referring to the passwd file, you will see it written as passwd(5). The screenshot explains how to open the man page in the correct section. man man If you want to know more about man, then Read The Fantastic Manual (RTFM). Unfortunately, manual pages do not have the answer to everything... mandb Should you be convinced that a man page exists, but you can't access it, then try running mandb on Debian/Mint. Institute of Aga Linux LPI Niyaz M. Salih (14)

16 Chapter 5. Working with directories pwd Then you are here sign can be displayed with the pwd command (Print Working Directory). Go ahead, try it: Open a command line interface (also called a terminal, console) and type pwd. The tool displays your current directory. cd You can change your current directory with the cd command (Change Directory). cd ~ The cd is also a shortcut to get back into your home directory. Just typing cd without a target directory, will put you in your home directory. Typing cd ~ has the same effect. cd.. To go to the parent directory (the one just above your current directory in the directory tree), type cd... Institute of Aga Linux LPI Niyaz M. Salih (15)

17 cd - Another useful shortcut with cd is to just type cd - to go to the previous directory. Absolute and relative paths You should be aware of absolute and relative paths in the file tree. When you type a path starting with a slash (/), then the root of the file tree is assumed. If you don't start your path with a slash, then the current directory is the assumed starting point. The screenshot below first shows the current directory /home/serverme. From within this directory, you have to type cd /home instead of cd home to go to the /home directory. When inside /home, you have to type cd serverme instead of cd /serverme to enter the subdirectory serverme of the current directory /home. Institute of Aga Linux LPI Niyaz M. Salih (16)

18 In case your current directory is the root directory /, then both cd /home and cd home will get you in the /home directory. Path completion The tab key can help you in typing a path without errors. Typing cd /et followed by the tab key will expand the command line to cd /etc/. When typing cd /Et followed by the tab key, nothing will happen because you typed the wrong path (upper case E). You will need fewer key strokes when using the tab key, and you will be sure your typed path is correct! ls You can list the contents of a directory with ls. ls -a A frequently used option with ls is -a to show all files. Showing all files means including the hidden files. When a file name on a Linux file system starts with a dot, it is considered a hidden file and it doesn't show up in regular file listings. Institute of Aga Linux LPI Niyaz M. Salih (17)

19 ls -l Many times you will be using options with ls to display the contents of the directory in different formats or to display different parts of the directory. Typing just ls gives you a list of files in the directory. Typing ls -l (that is a letter L, not the number 1) gives you a long listing. ls -lh Another frequently used ls option is -h. It shows the numbers (file sizes) in a more human readable format. Also shown below is some variation in the way you can give the options to ls. We will explain the details of the output later in this book. Note that we use the letter L as an option in this screenshot, not the number 1. Institute of Aga Linux LPI Niyaz M. Salih (18)

20 mkdir Walking around the Unix file tree is fun, but it is even more fun to create your own directories with mkdir. You have to give at least one parameter to mkdir, the name of the new directory to be created. Think before you type a leading /. mkdir -p The following command will fail, because the parent directory of threedirsdeep does not exist. rmdir When a directory is empty, you can use rmdir to remove the directory. Institute of Aga Linux LPI Niyaz M. Salih (19)

21 rmdir -p And similar to the mkdir -p option, you can also use rmdir to recursively remove directorie s. Institute of Aga Linux LPI Niyaz M. Salih (20)

22 Chapter 6. Working with files All files are case sensitive Files on Linux (or any Unix) are case sensitive. This means that FILE1 is different from file1, and /etc/hosts is different from /etc/hosts (the latter one does not exist on a typical Linux computer). This screenshot shows the difference between two files, one with upper case W, the other with lower case w. Everything is a file A directory is a special kind of file, but it is still a (case sensitive!) file. Each terminal window (for example /dev/pts/4), any hard disk or partition (for example /dev/sdb1) and any process are all represented somewhere in the file system as a file. It will become clear throughout this course that everything on Linux is a file. file The file utility determines the file type. Linux does not use extensions to determine the file type. The command line does not care whether a file ends in.txt or.pdf. As a system administrator, you should use the file command to determine the file type. Here are some examples on a typical Linux system. Institute of Aga Linux LPI Niyaz M. Salih (21)

23 The file command uses a magic file that contains patterns to recognise file types. The magic file is located in /usr/share/file/magic. Type man 5 magic for more information. It is interesting to point out file -s for special files like those in /dev and /proc. touch Create an empty file One easy way to create an empty file is with touch. (We will see many other ways for creating files later in this book.) This screenshot starts with an empty directory, creates two files with touch and the lists those files. Institute of Aga Linux LPI Niyaz M. Salih (22)

24 touch -t The touch command can set some properties while creating empty files. Can you determine what is set by looking at the next screenshot? If not, check the manual for touch. rm remove forever When you no longer need a file, use rm to remove it. Unlike some graphical user interfaces, the command line in general does not have a waste bin or trash can to recover files. When you use rm to remove a file, the file is gone. Therefore, be careful when removing files! Institute of Aga Linux LPI Niyaz M. Salih (23)

25 rm -i To prevent yourself from accidentally removing a file, you can type rm -i. rm -rf By default, rm -r will not remove non-empty directories. However rm accepts several options that will allow you to remove any directory. The rm -rf statement is famous because it will erase anything (providing that you have the permissions to do so). When you are logged on as root, be very careful with rm -rf (the f means force and the r means recursive) since being root implies that permissions don't apply to you. You can literally erase your entire file system by accident. Institute of Aga Linux LPI Niyaz M. Salih (24)

26 cp Copy one file To copy a file, use cp with a source and a target argument. Copy to another directory If the target is a directory, then the source files are copied to that target directory. cp -r To copy complete directories, use cp -r (the -r option forces recursive copying of all files in all subdirectories). Institute of Aga Linux LPI Niyaz M. Salih (25)

27 Copy multiple files to directory You can also use cp to copy multiple files into a directory. In this case, the last argument (a.k.a. the target) must be a directory. cp -i To prevent cp from overwriting existing files, use the -i (for interactive) option. mv Rename files with mv Use mv to rename a file or to move the file to another directory. When you need to rename only one file then mv is the preferred command to use. Institute of Aga Linux LPI Niyaz M. Salih (26)

28 Rename directories with mv The same mv command can be used to rename directories. mv -i The mv also has a -i switch similar to cp and rm. this screenshot shows that mv -i will ask permission to overwrite an existing file. Institute of Aga Linux LPI Niyaz M. Salih (27)

29 Chapter 7. working with file contents head You can use head to display the first ten lines of a file. The head command can also display the first n lines of a file. And head can also display the first n bytes. Institute of Aga Linux LPI Niyaz M. Salih (28)

30 tail Similar to head, the tail command will display the last ten lines of a file. You can give tail the number of lines you want to see. cat The cat command is one of the most universal tools, yet all it does is copy standard input to standard output. In combination with the shell this can be very powerful and diverse. Some examples will give a glimpse into the possibilities. The first example is simple, you can use cat to display a file on the screen. If the file is longer than the screen, it will scroll to the end. Institute of Aga Linux LPI Niyaz M. Salih (29)

31 Concatenate cat is short for concatenate. One of the basic uses of cat is to concatenate files into a bigger (or complete) file. Create files You can use cat to create flat text files. Type the cat > winter.txt command as shown in the screenshot below. Then type one or more lines, finishing each line with the enter key. After the last line, type and hold the Control (Ctrl) key and press d. Institute of Aga Linux LPI Niyaz M. Salih (30)

32 The Ctrl d key combination will send an EOF (End of File) to the running process ending the cat command. Custom end marker You can choose an end marker for cat with << as is shown in this screenshot. This construction is called a here directive and will end the cat command. Copy files In the third example you will see that cat can be used to copy files. We will explain in detail what happens here in the bash shell chapter. tac Just one example will show you the purpose of tac (cat backwards). Institute of Aga Linux LPI Niyaz M. Salih (31)

33 Chapter 8. The Linux file tree File system hierarchy standard Many Linux distributions partially follow the Filesystem Hierarchy Standard. The FHS may help make more Unix/Linux file system trees conform better in the future. The FHS is available online at where we read: "The filesystem hierarchy standard has been designed to be used by Unix distribution developers, package developers, and system implementers. However, it is primarily intended to be a reference and is not a tutorial on how to manage a Unix filesystem or directory hierarchy." man hier There are some differences in the filesystems between Linux distributions. For help about your machine, enter man hier to find information about the file system hierarchy. This manual will explain the directory structure on your computer. Institute of Aga Linux LPI Niyaz M. Salih (32)

34 The root directory / All Linux systems have a directory structure that starts at the root directory. The root directory is represented by a forward slash, like this: /. Everything that exists on your Linux system can be found below this root directory. Let's take a brief look at the contents of the root directory. Binary directories Binaries are files that contain compiled source code (or machine code). Binaries can be executed on the computer. Sometimes binaries are called executables. /bin The /bin directory contains binaries for use by all users. According to the FHS the /bin directory should contain /bin/cat and /bin/date (among others). In the screenshot below you see common Unix/Linux commands like cat, cp, cpio, date, dd, echo, grep, and so on. Many of these will be covered in this book. Other /bin directories You can find a /bin subdirectory in many other directories. A user named serena could put her own programs in /home/serena/bin. Institute of Aga Linux LPI Niyaz M. Salih (33)

35 Some applications, often when installed directly from source will put themselves in /opt. A samba server installation can use /opt/samba/bin to store its binaries. /sbin /sbin contains binaries to configure the operating system. Many of the system binaries require root privilege to perform certain tasks. Below a screenshot containing system binaries to change the ip address, partition a disk and create an ext4 file system. /lib Binaries found in /bin and /sbin often use shared libraries located in /lib. Below is a screenshot of the partial contents of /lib. /lib/modules Typically, the Linux kernel loads kernel modules from /lib/modules/$kernel-version/. This directory is discussed in detail in the Linux kernel chapter. Institute of Aga Linux LPI Niyaz M. Salih (34)

36 /lib32 and /lib64 We currently are in a transition between 32-bit and 64-bit systems. Therefore, you may encounter directories named /lib32 and /lib64 which clarify the register size used during compilation time of the libraries. A 64- bit computer may have some 32-bit binaries and libraries for compatibility with legacy applications. This screenshot uses the file utility to demonstrate the difference. The ELF (Executable and Linkable Format) is used in almost every Unix-like operating system since System V. /opt The purpose of /opt is to store optional software. In many cases this is software from outside the distribution repository. You may find an empty /opt directory on many systems. A large package can install all its files in /bin, /lib, /etc subdirectories within /opt/$packagename/. If for example the package is called wp, then it installs in /opt/wp, putting binaries in /opt/wp/bin and manpages in /opt/wp/man. Institute of Aga Linux LPI Niyaz M. Salih (35)

37 Configuration directories /boot The /boot directory contains all files needed to boot the computer. These files don't change very often. On Linux systems you typically find the /boot/grub directory here. /boot/grub contains /boot/grub/grub.cfg (older systems may still have /boot/grub/grub.conf) which defines the boot menu that is displayed before the kernel starts. /etc All of the machine-specific configuration files should be located in /etc. Historically /etc stood for etcetera, today people often use the Editable Text Configuration backronym. Many times the name of a configuration files is the same as the application, daemon, or protocol with.conf added as the extension. Data directories /home Users can store personal or project data under /home. It is common (but not mandatory by the fhs) practice to name the users home directory after the user name in the format /home/$username. For example: Institute of Aga Linux LPI Niyaz M. Salih (36)

38 Besides giving every user (or every project or group) a location to store personal files, the home directory of a user also serves as a location to store the user profile. A typical Unix user profile contains many hidden files (files whose file name starts with a dot). The hidden files of the Unix user profiles contain settings specific for that user. /root On many systems /root is the default location for personal data and profile of the root user. If it does not exist by default, then some administrators create it. /srv You may use /srv for data that is served by your system. The FHS allows locating cvs, rsync, ftp and www data in this location. The FHS also approves administrative naming in /srv, like /srv/project55/ftp and /srv/sales/www. On Sun Solaris (or Oracle Solaris) /export is used for this purpose. /media The /media directory serves as a mount point for removable media devices such as CD-ROM's, digital cameras, and various usb-attached devices. Since /media is rather new in the Unix world, you could very well encounter systems running without this directory. Solaris 9 does not have it, Solaris 10 does. Most Linux distributions today mount all removable media in /media. Institute of Aga Linux LPI Niyaz M. Salih (37)

39 /mnt The /mnt directory should be empty and should only be used for temporary mount points (according to the FHS). Unix and Linux administrators used to create many directories here, like /mnt/something/. You likely will encounter many systems with more than one directory created and/or mounted inside /mnt to be used for various local and remote filesystems. /tmp Applications and users should use /tmp to store temporary data when needed. Data stored in /tmp may use either disk space or RAM. Both of which are managed by the operating system. Never use /tmp to store data that is important or which you wish to archive. In memory directories /dev Device files in /dev appear to be ordinary files, but are not actually located on the hard disk. The /dev directory is populated with files as the kernel is recognising hardware. Common physical devices Common hardware such as hard disk devices are represented by device files in /dev. below a screenshot of SATA device files on a laptop and then IDE attached drives on a desktop. (The detailed meaning of these devices will be discussed later.) Institute of Aga Linux LPI Niyaz M. Salih (38)

40 Chapter 9: Network Configuration Ifconfig ifconfig (interface configurator) command is use to initialize an interface, assign IP Address to interface and enable or disable interface on demand. With this command you can view IP Address and Hardware / MAC address assign to interface and also MTU (Maximum transmission unit) size. ifconfig with interface (eth0) command only shows specific interface details like IP Address, MAC Address etc. with -a options will display all available interface details if it is disable also. Institute of Aga Linux LPI Niyaz M. Salih (39)

41 Configure with static IP address To configuration network need to open /etc/network/interfaces interface configuration file. Press Ctrl+X then press Y and press Enter To enable or disable specific Interface, we use example command as follows. Institute of Aga Linux LPI Niyaz M. Salih (40)

42 Disable Ethernet Ifdown Enable Ethernet Ifup Route route command also shows and manipulate ip routing table. To see default routing table in Linux, type the following command. Institute of Aga Linux LPI Niyaz M. Salih (41)

43 Ping PING (Packet Internet Groper) command is the best way to test connectivity between two nodes. Whether it is Local Area Network (LAN) or Wide Area Network (WAN). Ping use ICMP (Internet Control Message Protocol) to communicate to other devices. You can ping host name of ip address using below command. Institute of Aga Linux LPI Niyaz M. Salih (42)

44 Configure with Dynamic IP To configuration network need to open /etc/network/interfaces interface configuration file. Press Ctrl+X then press Y and press Enter Disable Ethernet Enable Ethernet Institute of Aga Linux LPI Niyaz M. Salih (43)

45 Chapter 10: Disk Management and Partitions Fdisk(fixed disk or format disk) is a text-based command-line utility for viewing and managing hard disk partitions on Linux. Using fdisk you can view, create, resize, delete, change, copy and move partitions. Fdisk allows you to create a maximum of four primary partitions as permitted by Linux with each requiring a minimum size of 40mb. You can also have a much larger number of logical partitions by subdividing a primary partition. In this article, let us review how to use fdisk command to manage disk partitions by employing some very simple and practical examples. Important points to note 1. Fdisk requires root to operate. On Debian and Ubuntu based systems, you can prefix with sudo. On other distros, use sucommand to get a root shell and then enter the commands without sudo. 2. Take note of the form the device names (disks) are presented. Usually you see following names /dev/hd[a-h] for IDE disks /dev/sd[a-p] for SCSI disks /dev/ed[a-d] for ESDI disks /dev/xd[ab] for XT disks 3. Warning: Do not delete, modify, or add partition unless you know exactly what you are about. You ran the risk of losing your data! Institute of Aga Linux LPI Niyaz M. Salih (44)

46 View All Existing Disk Partitions The first thing you want to do before tampering with your disks and partition is to view basic details about all available partition in the system. The commands list the partitions on your system. When you have more than one disk available, the partitions list are ordered by the device s /dev name as in /dev/sda, /dev/sdb and so on. Use the following command to view all existing partitions in the system View Partition on a Specific Disk If you want to look at all the partitions on a specific disk, use the following command to view all disk partitions on device /dev/sda. Institute of Aga Linux LPI Niyaz M. Salih (45)

47 View all fdisk Commands You can use the following command to view all available fdisk This will provide you with a prompt. Enter m to see the list of all available commands of fdisk which can be operated on /dev/sda. The output will be this Institute of Aga Linux LPI Niyaz M. Salih (46)

48 Delete a Hard Disk Partition Assuming you need to combine some partitions to form a larger one, you will first have to delete those partitions. To delete a specific partition on /dev/sda2, follow the following - 1. Enter the following command to enter/view the disk 2. Enter d to delete a partition. 3. You will be prompted to enter the partition number. We enter 2 in our case to delete /dev/sda2. Save changes by entering w at command and reboot for changes. Create a New Disk Partition with Specific Size To create a new partition, enter the following command 1. Enter the following command to enter/view the disk 2. Enter n to create a new partition which will prompt you to specify for either a primary partition or an extended partition. Enter p for a primary partition or e for an extended partition. Institute of Aga Linux LPI Niyaz M. Salih (47)

49 3. You will then be prompted to enter the first cylinder or sector number of the partition to be created. You may press Enter to accept the defaults. 4. You will then be prompted to enter the Last cylinder or sector number of the partition to be created. You may press Enter to use all available space after the first sector or enter a specific size such as +2G or +256M for a 2 gigabyte or 256 megabyte partition respectively. 5. Run w command to write the changes and reboot your system. How to Format a Partition? After you have created your partition, you need to format it with a file system. Use the following command to format to ext4 file format How to View the Size of your new or existing Partition? If you want to check the size of a specific partitions, use the following command to check the size of partition on /dev/sda2. Viewing the Partition Table You can use the following command to look at your current partition table - Use p in command mode. Institute of Aga Linux LPI Niyaz M. Salih (48)

50 Chapter 11: File System Administration In UNIX several commands are available for file system managements. Before you start practice of creating and deleting partition it is better to do some practice with these commands. df This is handy command to check available free space. Run df command If you feel difficulty in understanding the blocks use -h switch with du command Institute of Aga Linux LPI Niyaz M. Salih (49)

51 du This is useful command to check the size of file. While df commands show the available space in partitions, du commands show the size of files in partitions. You could use df command to check the space used by each partitions. If you need more detail about any specific partition like which file is consuming more space then you could use du command. For example we would like to know how much space is used by /boot partition? How much space is available in /boot partition? What is the size of each files and directories in /boot partition? To get the answer of these questions we would first execute df command with -h switch. It would give us the answer of first and second question. To know the answer of third question use du command with -h switch. You may get confuse from output. As df commands show boot partition is using 27 MB while du command is showing that /boot is using 21 MB so where is remaining 6 MB space?. This space is used by hidden files. You could use du command with -a switch to show the hidden files. Institute of Aga Linux LPI Niyaz M. Salih (50)

52 When you install Linux, the installation program configures the file /etc/fstab to specify what filesystems are to be mounted when the system is started. Here's a typical /etc/fstab file: The first three lines, those beginning with a hash mark (#), are comments that are ignored by the system; they merely help human readers identify and understand the file. The next three lines each specify a filesystem to be mounted at system startup. Six columns of information appear: Filesystem The device that contains the filesystem. Mount point The system directory that will hold the filesystem. Filesystem type Specifies the type of the filesystem. Popular types include: ext2 the standard Linux filesystem. swap Institute of Aga Linux LPI Niyaz M. Salih (51)

53 the standard Linux swap filesystem proc a special filesystem provided by the kernel, used by system components to obtain system information in a standard way iso9660 the standard filesystem used on CD-ROM msdos the standard MS-DOS filesystem See the man page for mount for other filesystem types. Mount options Specifies the options given when the filesystem is mounted. If multiple options are given, each is separated from the next by a comma (,); no spaces appear within the list of options. Popular options include: defaults Specifies a series of options appropriate for most filesystems. For details, see the man page for mount. errors=remount-ro Specifies that if errors are found when the filesystem is checked, the filesystem will be remounted in read-only mode so that the system administrator can analyze the errors without risking further damage. sw Specifies that the filesystem will be mounted as a swap partition. ro Institute of Aga Linux LPI Niyaz M. Salih (52)

54 Specifies that the filesystem will be mounted for read access only. This option is always specified for CD-ROM devices and may be specified for other devices. noauto Specifies that the filesystem will not be automatically mounted at system startup. In addition, the user option can be specified. This option allows any user - not only root - to mount the filesystem. Dump flag Pass Specifies whether the dump command will create a backup of the filesystem. Filesystems with no value or a value of zero will not be dumped. Specifies the order in which filesystems are checked at boot time. No value or a value of zero specifies that the filesystem will not be checked. Institute of Aga Linux LPI Niyaz M. Salih (53)

55 Chapter 12: File Security Standard file Permissions file ownership user owner and group owner The users and groups of a system can be locally managed in /etc/passwd and /etc/group, or they can be in a NIS, LDAP, or Samba domain. These users and groups can own files. Actually, every file has a user owner and a group owner, as can be seen in the following screenshot. This file is owned by the root user and the root group. listing user accounts You can use the following command to list all local user accounts. chgrp You can change the group owner of a file using the chgrp command. Institute of Aga Linux LPI Niyaz M. Salih (54)

56 chown The user owner of a file can be changed with chown command. You can also use chown to change both the user owner and the group owner. List of special files When you use ls -l, for each file you can see ten characters before the user and group owner. The first character tells us the type of file. Regular files get a -, directories get a d, symbolic links are shown with an l, pipes get a p, character devices a c, block devices a b, and sockets an s. Institute of Aga Linux LPI Niyaz M. Salih (55)

57 Unix special files first character file type - normal file D L P B C S directory symbolic link named pipe block device character device socket Below a screenshot of a character device (the console) and a block device (the hard disk). And here you can see a directory, a regular file and a symbolic link. permissions rwx The nine characters following the file type denote the permissions in three triplets. A permission can be r for read access, w for write access, and x for execute. You need the r permission to list (ls) the contents of a directory. You need the x permission to enter (cd) a directory. You need the w permission to create files in or remove files from a directory. Institute of Aga Linux LPI Niyaz M. Salih (56)

58 Standard Unix file permissions permission on a file on a directory r (read) w (write) read file contents (cat) read directory contents (ls) change file contents (vi) create files in (touch) x (execute) execute the file enter the directory (cd) Three sets of rwx We already know that the output of ls -l starts with ten characters for each file. This screenshot shows a regular file (because the first character is a -). Below is a table describing the function of all ten characters. Unix file permissions position position characters function 1 - this is a regular file 2-4 rwx permissions for the user owner 5-7 r-x permissions for the group owner 8-10 r-- permissions for others When you are the user owner of a file, then the user owner permissions apply to you. The rest of the permissions have no influence on your access to the file. Institute of Aga Linux LPI Niyaz M. Salih (57)

59 When you belong to the group that is the group owner of a file, then the group owner permissions apply to you. The rest of the permissions have no influence on your access to the file. When you are not the user owner of a file and you do not belong to the group owner, then the others permissions apply to you. The rest of the permissions have no influence on your access to the file. To summarise, the first rwx triplet represents the permissions for the user owner. The second triplet corresponds to the group owner; it specifies permissions for all members of that group. The third triplet defines permissions for all other users that are not the user owner and are not a member of the group owner. Setting permissions (chmod) Permissions can be changed with chmod. The first example gives the user owner execute permissions. Institute of Aga Linux LPI Niyaz M. Salih (58)

60 Setting octal permissions Most Unix administrators will use the old school octal system to talk about and set permissions. Look at the triplet bitwise, equating r to 4, w to 2, and x to 1. Octal permissions binary octal permission x w wx r r-x rw rwx This makes 777 equal to rwxrwxrwx and by the same logic, 654 mean rw-rxr--. The chmod command will accept these numbers. Institute of Aga Linux LPI Niyaz M. Salih (59)

61 umask When creating a file or directory, a set of default permissions are applied. These default permissions are determined by the umask. The umask specifies permissions that you do not want set on by default. You can display the umask with the umask command. mkdir -m When creating directories with mkdir you can use the -m option to set the mode. This screenshot explains. cp -p To preserve permissions and time stamps from source files, use cp -p. Institute of Aga Linux LPI Niyaz M. Salih (60)

62 Access Control Lists acl in /etc/fstab File systems that support access control lists, or acls, have to be mounted with the acl option listed in /etc/fstab. In the example below, you can see that the root file system has acl support, whereas /home/data does not. getfacl Reading acls can be done with /usr/bin/getfacl. This screenshot shows how to read the acl of niyaz with getfacl. setfacl Writing or changing acls can be done with /usr/bin/setfacl. These screenshots show how to change the acl of niyaz with setfacl. First we add user serverme with octal permission 7 to the acl. Then we add the group tennis with octal permission 6 to the acl of the same file. Institute of Aga Linux LPI Niyaz M. Salih (61)

63 remove an acl entry The -x option of the setfacl command will remove an acl entry from the targeted file. Note that omitting the u or g when defining the acl for an account will default it to a user account. remove the complete acl The -b option of the setfacl command will remove the acl from the targeted file. Institute of Aga Linux LPI Niyaz M. Salih (62)

64 the acl mask The acl mask defines the maximum effective permissions for any entry in the acl. This mask is calculated every time you execute the setfacl or chmod commands. You can prevent the calculation by using the --no-mask switch. Institute of Aga Linux LPI Niyaz M. Salih (63)

65 Chapter 13: Local user management Enabling the root user To run administrative tasks in Linux, you must have root (also known as super user) access. Having a separate root account is common in most Linux distributions, but Ubuntu disables root by default. This prevents users from making mistakes and keeps the system safe from intruders. To run commands that require root access, use sudo Managing Users and Groups There are four main user administration files /etc/passwd Keeps the user account and password information. This file holds the majority of information about accounts on the Unix system. /etc/shadow Holds the encrypted password of the corresponding account. Not all the systems support this file. /etc/group This file contains the group information for each account. /etc/gshadow This file contains secure group account information. Check all the above files using the cat command. Institute of Aga Linux LPI Niyaz M. Salih (64)

66 S.No. Command & Description 1 useradd Adds accounts to the system 2 usermod 3 userdel Modifies account attributes Deletes accounts from the system 4 groupadd Adds groups to the system 5 groupmod Modifies group attributes 6 groupdel Removes groups from the system Create a Group We will now understand how to create a group. For this, we need to create groups before creating any account otherwise, we can make use of the existing groups in our system. We have all the groups listed in /etc/groups file. All the default groups are system account specific groups and it is not recommended to use them for ordinary accounts. So, following is the syntax to create a new group account Institute of Aga Linux LPI Niyaz M. Salih (65)

67 groupadd [-g gid [-o]] [-r] [-f] groupname The following table lists out the parameters S.No. Option & Description 1 -g GID The numerical value of the group's ID 2 -o 3 -r 4 -f This option permits to add group with non-unique GID This flag instructs groupadd to add a system account This option causes to just exit with success status, if the specified group already exists. With -g, if the specified GID already exists, other uniqueunique GID is chosen 5 groupname Actual group name to be created If you do not specify any parameter, then the system makes use of the default values. Institute of Aga Linux LPI Niyaz M. Salih (66)

68 Following example creates a developers group with default values, which is very much acceptable for most of the administrators. Modify a Group To modify a group, use the groupmod syntax $ groupmod -n new_modified_group_name old_group_name To change the developers group name to developer_2, type Here is how you will change the financial GID to 545 Delete a Group We will now understand how to delete a group. To delete an existing group, all you need is the groupdel command and the group name. To delete the financial group, the command is This removes only the group, not the files associated with that group. The files are still accessible by their owners. Institute of Aga Linux LPI Niyaz M. Salih (67)

69 Create an Account Let us see how to create a new account on your Unix system. Following is the syntax to create a user's account useradd -d homedir -g groupname -m -s shell -u userid accountname The following table lists out the parameters S.No. Option & Description 1 -d homedir Specifies home directory for the account 2 -g groupname 3 -m 4 -s shell Specifies a group account for this account Creates the home directory if it doesn't exist Specifies the default shell for this account 5 -u userid You can specify a user id for this account 6 accountname Actual account name to be created If you do not specify any parameter, then the system makes use of the default values. The useradd command modifies. Institute of Aga Linux LPI Niyaz M. Salih (68)

70 the /etc/passwd, /etc/shadow, and /etc/group files and creates a home directory. Following is the example that creates an account aga. Setting its home directory to /home/aga and the group as developers. This user would have Korn Shell assigned to it. Before issuing the above command, make sure you already have the developers group created using the groupadd command. Once an account is created you can set its password using the passwd command as follows When you type passwd accountname, it gives you an option to change the password, provided you are a superuser. Otherwise, you can change just your password using the same command but without specifying your account name. Modify an Account The usermod command enables you to make changes to an existing account from the command line. It uses the same arguments as the useradd command, plus the -l argument, which allows you to change the account name. For example, to change the account name aga to aga2 and to change home directory accordingly, you will need to issue the following command Institute of Aga Linux LPI Niyaz M. Salih (69)

71 Delete an Account The userdel command can be used to delete an existing user. This is a very dangerous command if not used with caution. There is only one argument or option available for the command.r, for removing the account's home directory and mail file. For example, to remove account mcmohd20, issue the following command If you want to keep the home directory for backup purposes, omit the - r option. You can remove the home directory as needed at a later time. Institute of Aga Linux LPI Niyaz M. Salih (70)

Lecture 1 Niyaz M. Salih

Lecture 1 Niyaz M. Salih Lecture 1 Niyaz M. Salih Definition An Operating System, or OS, is low-level software that enables a user and higher-level application software to interact with a computer s hardware and the data and other

More information

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories Chapter Two Exploring the UNIX File System and File Security Lesson A Understanding Files and Directories 2 Objectives Discuss and explain the UNIX file system Define a UNIX file system partition Use the

More information

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions Lanka Education and Research Network Linux Architecture, Linux File System, Linux Basic Commands 28 th November 2016 Dilum Samarasinhe () Overview History of Linux Linux Architecture Linux File System

More information

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers Review of the Linux File System and Linux Commands 1. Introduction Becoming adept at using the Linux OS requires gaining familiarity

More information

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions Welcome to getting started with Ubuntu 12.04 Server. This System Administrator Manual guide to be simple to follow, with step by step instructions with screenshots INDEX 1.Installation of Ubuntu 12.04

More information

Linux Essentials Objectives Topics:

Linux Essentials Objectives Topics: Linux Essentials Linux Essentials is a professional development certificate program that covers basic knowledge for those working and studying Open Source and various distributions of Linux. Exam Objectives

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Kisik Jeong (kisik@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating

More information

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University Introduction to Linux Woo-Yeong Jeong (wooyeong@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating system of a computer What is an

More information

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

Linux Kung Fu. Stephen James UBNetDef, Spring 2017 Linux Kung Fu Stephen James UBNetDef, Spring 2017 Introduction What is Linux? What is the difference between a client and a server? What is Linux? Linux generally refers to a group of Unix-like free and

More information

INTRODUCTION TO LINUX

INTRODUCTION TO LINUX INTRODUCTION TO LINUX REALLY SHORT HISTORY Before GNU/Linux there were DOS, MAC and UNIX. All systems were proprietary. The GNU project started in the early 80s by Richard Stallman Goal to make a free

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Dong-Yun Lee (dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating

More information

This is Worksheet and Assignment 12. Disks, Partitions, and File Systems

This is Worksheet and Assignment 12. Disks, Partitions, and File Systems This is Worksheet and Assignment 12 This is a combined Worksheet and Assignment.. Quizzes and tests may refer to work done in this Worksheet and Assignment; save your answers. You will use a checking program

More information

Introduction. What is Linux? What is the difference between a client and a server?

Introduction. What is Linux? What is the difference between a client and a server? Linux Kung Fu Introduction What is Linux? What is the difference between a client and a server? What is Linux? Linux generally refers to a group of Unix-like free and open-source operating system distributions

More information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

More information

The kernel is the low-level software that manages hardware, multitasks programs, etc.

The kernel is the low-level software that manages hardware, multitasks programs, etc. November 2011 1 Why Use Linux? Save Money Initial purchase and maintenance Resume Linux is used by MANY organizations More choices Tons of Linux operating systems November 2011 2 What is Linux? 1. Contains

More information

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System Class Meeting 2 * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System The file system is your interface to: physical

More information

LAB #7 Linux Tutorial

LAB #7 Linux Tutorial Gathering information: LAB #7 Linux Tutorial Find the password file on a Linux box Scenario You have access to a Linux computer. You must find the password file on the computer. Objective Get a listing

More information

Linux Command Line Primer. By: Scott Marshall

Linux Command Line Primer. By: Scott Marshall Linux Command Line Primer By: Scott Marshall Draft: 10/21/2007 Table of Contents Topic Page(s) Preface 1 General Filesystem Background Information 2 General Filesystem Commands 2 Working with Files and

More information

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME Introduction to the Unix command line History Many contemporary computer operating systems, like Microsoft Windows and Mac OS X, offer primarily (but not exclusively) graphical user interfaces. The user

More information

UNIX File Hierarchy: Structure and Commands

UNIX File Hierarchy: Structure and Commands UNIX File Hierarchy: Structure and Commands The UNIX operating system organizes files into a tree structure with a root named by the character /. An example of the directory tree is shown below. / bin

More information

National University of Computer and Emerging Sciences Operating System Lab - 02 Lab Manual

National University of Computer and Emerging Sciences Operating System Lab - 02 Lab Manual National University of Computer and Emerging Sciences Operating System Lab - 02 Lab Manual Objective This lab is all about running commands in Ubuntu Terminal and compiling C program in Ubuntu Table of

More information

Getting Started with Linux

Getting Started with Linux Getting Started with Linux For those with experience using Microsoft Windows there will be many familiar ways of operating in a Linux environment. There are also a few key differences. The main differences

More information

Linux Files and the File System

Linux Files and the File System Linux Files and the File System 1. Files a. Overview A simple description of the UNIX system, also applicable to Linux, is this: "On a UNIX system, everything is a file; if something is not a file, it

More information

Disks, Filesystems 1

Disks, Filesystems 1 Disks, Filesystems 1 sudo and PATH (environment) disks partitioning formatting file systems: mkfs command checking file system integrity: fsck command /etc/fstab mounting file systems: mount command unmounting

More information

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010 Lecture 2 Fall 2010 Hussam Abu-Libdeh based on slides by David Slater September 10, 2010 Last Time We had a brief discussion On The Origin of Species *nix systems Today We roll our sleeves and get our

More information

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix Filesystem. January 26 th, 2004 Class Meeting 2 Unix Filesystem January 26 th, 2004 Class Meeting 2 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty at Virginia Tech Unix Filesystem! The filesystem is your interface

More information

CST8207: GNU/Linux Operating Systems I Lab Ten Boot Process and GRUB. Boot Process and GRUB

CST8207: GNU/Linux Operating Systems I Lab Ten Boot Process and GRUB. Boot Process and GRUB Student Name: Lab Section: Boot Process and GRUB 1 Due Date - Upload to Blackboard by 8:30am Monday April 16, 2012 Submit the completed lab to Blackboard following the Rules for submitting Online Labs

More information

CS Fundamentals of Programming II Fall Very Basic UNIX

CS Fundamentals of Programming II Fall Very Basic UNIX CS 215 - Fundamentals of Programming II Fall 2012 - Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the CS (Project) Lab (KC-265)

More information

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG *nix Crash Course Presented by: Virginia Tech Linux / Unix Users Group VTLUUG Ubuntu LiveCD No information on your hard-drive will be modified. Gives you a working Linux system without having to install

More information

Outline. Structure of a UNIX command

Outline. Structure of a UNIX command Outline Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission (owner, group, rwx) File and directory

More information

CS197U: A Hands on Introduction to Unix

CS197U: A Hands on Introduction to Unix CS197U: A Hands on Introduction to Unix Lecture 3: UNIX Operating System Organization Tian Guo CICS, Umass Amherst 1 Reminders Assignment 2 is due THURSDAY 09/24 at 3:45 pm Directions are on the website

More information

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018 GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux

More information

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems. Copyleft 2005, Binnur Kurt 3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.

More information

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out

More information

Course 144 Supplementary Materials. UNIX Fundamentals

Course 144 Supplementary Materials. UNIX Fundamentals Course 144 Supplementary Materials UNIX Fundamentals 1 Background to UNIX Command Fundamentals This appendix provides a overview of critical commands and concepts Prerequisite knowledge attendees should

More information

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm Operating Systems Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) armahmood786@yahoo.com alphasecure@gmail.com alphapeeler.sf.net/pubkeys/pkey.htm http://alphapeeler.sourceforge.net pk.linkedin.com/in/armahmood

More information

Working with Basic Linux. Daniel Balagué

Working with Basic Linux. Daniel Balagué Working with Basic Linux Daniel Balagué How Linux Works? Everything in Linux is either a file or a process. A process is an executing program identified with a PID number. It runs in short or long duration

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80 CSE 303 Lecture 2 Introduction to bash shell read Linux Pocket Guide pp. 37-46, 58-59, 60, 65-70, 71-72, 77-80 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Unix file system structure

More information

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating

More information

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Embedded Linux Systems Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Generic Embedded Systems Structure User Sensors ADC microcontroller

More information

Chapter 1 - Introduction. September 8, 2016

Chapter 1 - Introduction. September 8, 2016 Chapter 1 - Introduction September 8, 2016 Introduction Overview of Linux/Unix Shells Commands: built-in, aliases, program invocations, alternation and iteration Finding more information: man, info Help

More information

MANAGING THE NONUNIFORM BEHAVIOUR OF TERMINALS AND KEYBOARDS. : WHEN THINGS GO WRONG

MANAGING THE NONUNIFORM BEHAVIOUR OF TERMINALS AND KEYBOARDS. : WHEN THINGS GO WRONG MANAGING THE NONUNIFORM BEHAVIOUR OF TERMINALS AND KEYBOARDS. : WHEN THINGS GO WRONG Terminals and keyboards have no uniform behavioral pattern. Terminal settings directly impact the keyboard operation.

More information

This is Lab Worksheet 13 - not an Assignment. Boot Process and GRUB

This is Lab Worksheet 13 - not an Assignment. Boot Process and GRUB This is Lab Worksheet 13 - not an Assignment This Lab Worksheet contains some practical examples that will prepare you to complete your Assignments. You do not have to hand in this Lab Worksheet. Make

More information

CST8207: GNU/Linux Operating Systems I Lab Seven Linux User and Group Management. Linux User and Group Management

CST8207: GNU/Linux Operating Systems I Lab Seven Linux User and Group Management. Linux User and Group Management Student Name: YOUR NAME Lab Section: 011 012 013 or 014 Linux User and Group Management 1 Due Date - Upload to Blackboard by 8:30am Monday April 2, 2012 Submit the completed lab to Blackboard following

More information

Manage Directories and Files in Linux. Objectives. Understand the Filesystem Hierarchy Standard (FHS)

Manage Directories and Files in Linux. Objectives. Understand the Filesystem Hierarchy Standard (FHS) Manage Directories and Files in Linux Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change Directories and List Directory Contents Create and View

More information

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1 Student Name: Lab Section: Linux File System Permissions (modes) - Part 1 Due Date - Upload to Blackboard by 8:30am Monday March 12, 2012 Submit the completed lab to Blackboard following the Rules for

More information

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

More information

UNIT 9 Introduction to Linux and Ubuntu

UNIT 9 Introduction to Linux and Ubuntu AIR FORCE ASSOCIATION S CYBERPATRIOT NATIONAL YOUTH CYBER EDUCATION PROGRAM UNIT 9 Introduction to Linux and Ubuntu Learning Objectives Participants will understand the basics of Linux, including the nature,

More information

Chapter 5: User Management. Chapter 5 User Management

Chapter 5: User Management. Chapter 5 User Management Chapter 5: User Management Chapter 5 User Management Last revised: 20/6/2004 Chapter 5 Outline In this chapter we will learn Where user and group account information is stored How to manage user accounts

More information

CST8207: GNU/Linux Operating Systems I Lab Seven Linux User and Group Management. Linux User and Group Management

CST8207: GNU/Linux Operating Systems I Lab Seven Linux User and Group Management. Linux User and Group Management Student Name: Lab Section: Linux User and Group Management 1 Due Date - Upload to Blackboard by 8:30am Monday April 2, 2012 Submit the completed lab to Blackboard following the Rules for submitting Online

More information

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the EECS labs that dual boot

More information

Disks, Filesystems Todd Kelley CST8177 Todd Kelley 1

Disks, Filesystems Todd Kelley CST8177 Todd Kelley 1 Disks, Filesystems Todd Kelley kelleyt@algonquincollege.com CST8177 Todd Kelley 1 sudo and PATH (environment) disks partitioning formatting file systems: mkfs command checking file system integrity: fsck

More information

Presented by Bill Genske Gary Jackson

Presented by Bill Genske Gary Jackson Quintessential School Systems Session C Linux Presented by Bill Genske Gary Jackson Copyright Quintessential School Systems, 2009 All Rights Reserved 867 American Street --- Second Floor --- San Carlos,

More information

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering ENG224 Information Technology Part I: Computers and the Internet Laboratory 2 Linux Shell Commands and vi Editor

More information

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one] Data and Computer Security (CMPD414) Lab II Topics: secure login, moving into HOME-directory, navigation on Unix, basic commands for vi, Message Digest This lab exercise is to be submitted at the end of

More information

Files

Files http://www.cs.fsu.edu/~langley/cop3353-2013-1/reveal.js-2013-02-11/02.html?print-pdf 02/11/2013 10:55 AM Files A normal "flat" file is a collection of information. It's usually stored somewhere reasonably

More information

Disks, Filesystems, Booting Todd Kelley CST8177 Todd Kelley 1

Disks, Filesystems, Booting Todd Kelley CST8177 Todd Kelley 1 Disks, Filesystems, Booting Todd Kelley kelleyt@algonquincollege.com CST8177 Todd Kelley 1 sudo and PATH (environment) disks partitioning formatting file systems: mkfs command checking file system integrity:

More information

Getting your department account

Getting your department account 02/11/2013 11:35 AM Getting your department account The instructions are at Creating a CS account 02/11/2013 11:36 AM Getting help Vijay Adusumalli will be in the CS majors lab in the basement of the Love

More information

Chapter 6. Linux File System

Chapter 6. Linux File System Chapter 6 Linux File System 1 File System File System management how to store informations on storage devices The Hierarchical Structure Types of file Common File system Tasks 2 The Hierarchical Structure

More information

NETW 110 Lab 5 Creating and Assigning Users and Groups Page 1

NETW 110 Lab 5 Creating and Assigning Users and Groups Page 1 NETW 110 Lab 5 Creating and Assigning Users and Groups Page 1 Objective At the conclusion of this lab, the student will be able to add and delete users, create and assign users to groups, and assign users

More information

Mills HPC Tutorial Series. Linux Basics I

Mills HPC Tutorial Series. Linux Basics I Mills HPC Tutorial Series Linux Basics I Objectives Command Line Window Anatomy Command Structure Command Examples Help Files and Directories Permissions Wildcards and Home (~) Redirection and Pipe Create

More information

Embedded System Design

Embedded System Design Embedded System Design Lecture 10 Jaeyong Chung Systems-on-Chips (SoC) Laboratory Incheon National University Environment Variables Environment variables are a set of dynamic named values that can affect

More information

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---

More information

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

Computer Architecture Lab 1 (Starting with Linux)

Computer Architecture Lab 1 (Starting with Linux) Computer Architecture Lab 1 (Starting with Linux) Linux is a computer operating system. An operating system consists of the software that manages your computer and lets you run applications on it. The

More information

Lab E2: bypassing authentication and resetting passwords

Lab E2: bypassing authentication and resetting passwords Lab E2: bypassing authentication and resetting passwords TTM4175 September 7, 2015 The purpose of this lab is to learn about techniques for bypassing the authentication and access control of Windows and

More information

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017 Linux Kung Fu Ross Ventresca UBNetDef, Fall 2017 GOTO: https://apps.ubnetdef.org/ What is Linux? Linux generally refers to a group of Unix-like free and open source operating system distributions built

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA Sanghoon Han(sanghoon.han@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Announcement (1) Please come

More information

Introduction to Linux

Introduction to Linux Introduction to Linux The command-line interface A command-line interface (CLI) is a type of interface, that is, a way to interact with a computer. Window systems, punched cards or a bunch of dials, buttons

More information

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12) Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12) Objective: Learn some basic aspects of the UNIX operating system and how to use it. What is UNIX? UNIX is the operating system used by most computers

More information

CSE 390a Lecture 4. Persistent shell settings; users/groups; permissions

CSE 390a Lecture 4. Persistent shell settings; users/groups; permissions CSE 390a Lecture 4 Persistent shell settings; users/groups; permissions slides created by Marty Stepp, modified by Jessica Miller and Ruth Anderson http://www.cs.washington.edu/390a/ 1 2 Lecture summary

More information

Installation of the OS

Installation of the OS Lab 1 Installation of the OS 1.1 Objectives The goal of this first session is to install a Debian/Linux operating system from scratch on a Intel x86- based computer. The installation will be made on a

More information

Linux Systems Administration Getting Started with Linux

Linux Systems Administration Getting Started with Linux Linux Systems Administration Getting Started with Linux Network Startup Resource Center www.nsrc.org These materials are licensed under the Creative Commons Attribution-NonCommercial 4.0 International

More information

Unix System Architecture, File System, and Shell Commands

Unix System Architecture, File System, and Shell Commands Unix System Architecture, File System, and Shell Commands Prof. (Dr.) K.R. Chowdhary, Director COE Email: kr.chowdhary@iitj.ac.in webpage: http://www.krchowdhary.com JIET College of Engineering August

More information

Introduction of Linux

Introduction of Linux Introduction of Linux 阳 oslab2018_class1@163.com 寅 oslab2018_class2@163.com PART I Brief Introduction Basic Conceptions & Environment Install & Configure a Virtual Machine Basic Commands PART II Shell

More information

Full file at https://fratstock.eu

Full file at https://fratstock.eu Guide to UNIX Using Linux Fourth Edition Chapter 2 Solutions Answers to the Chapter 2 Review Questions 1. Your company is discussing plans to migrate desktop and laptop users to Linux. One concern raised

More information

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version... Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing

More information

CSE 390a Lecture 4. Persistent shell settings; users/groups; permissions

CSE 390a Lecture 4. Persistent shell settings; users/groups; permissions CSE 390a Lecture 4 Persistent shell settings; users/groups; permissions slides created by Marty Stepp, modified by Jessica Miller and Ruth Anderson http://www.cs.washington.edu/390a/ 1 2 Lecture summary

More information

5/8/2012. Creating and Changing Directories Chapter 7

5/8/2012. Creating and Changing Directories Chapter 7 Creating and Changing Directories Chapter 7 Types of files File systems concepts Using directories to create order. Managing files in directories. Using pathnames to manage files in directories. Managing

More information

Commands are in black

Commands are in black Starting From the Shell Prompt (Terminal) Commands are in black / +--------+---------+-------+---------+---------+------ +------ +------ +------ +------ +------ +-- Bin boot dev etc home media sbin bin

More information

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands 1 What is an Operating System? A computer program that: Controls how the CPU, memory

More information

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14 Introduction to Linux (Part I) BUPT/QMUL 2018/03/14 Contents 1. Background on Linux 2. Starting / Finishing 3. Typing Linux Commands 4. Commands to Use Right Away 5. Linux help continued 2 Contents 6.

More information

Session 1: Accessing MUGrid and Command Line Basics

Session 1: Accessing MUGrid and Command Line Basics Session 1: Accessing MUGrid and Command Line Basics Craig A. Struble, Ph.D. July 14, 2010 1 Introduction The Marquette University Grid (MUGrid) is a collection of dedicated and opportunistic resources

More information

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Introduction to remote command line Linux. Research Computing Team University of Birmingham Introduction to remote command line Linux Research Computing Team University of Birmingham Linux/UNIX/BSD/OSX/what? v All different v UNIX is the oldest, mostly now commercial only in large environments

More information

How To Resize ext3 Partitions Without Losing Data

How To Resize ext3 Partitions Without Losing Data By Falko Timme Published: 2007-01-07 17:12 How To Resize ext3 Partitions Without Losing Data Version 1.0 Author: Falko Timme Last edited 12/31/2006 This article is about

More information

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Linux Kung-Fu. James Droste UBNetDef Fall 2016 Linux Kung-Fu James Droste UBNetDef Fall 2016 $ init 1 GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org

More information

User Accounts. The Passwd, Group, and Shadow Files

User Accounts. The Passwd, Group, and Shadow Files User Accounts The Passwd, Group, and Shadow Files We'll start with the passwd (pronounced "password") file, located at /etc/passwd. This file holds information about all of the user accounts on the system.

More information

Operating Systems Lab 1 (Users, Groups, and Security)

Operating Systems Lab 1 (Users, Groups, and Security) Operating Systems Lab 1 (Users, Groups, and Security) Overview This chapter covers the most common commands related to users, groups, and security. It will also discuss topics like account creation/deletion,

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

INF322 Operating Systems

INF322 Operating Systems Galatasaray University Computer Engineering Department INF322 Operating Systems TP01: Introduction to Linux Ozan Çağlayan ocaglayan@gsu.edu.tr ozancaglayan.com Fundamental Concepts Definition of Operating

More information

CS/CIS 249 SP18 - Intro to Information Security

CS/CIS 249 SP18 - Intro to Information Security Lab assignment CS/CIS 249 SP18 - Intro to Information Security Lab #2 - UNIX/Linux Access Controls, version 1.2 A typed document is required for this assignment. You must type the questions and your responses

More information

Linux File System and Basic Commands

Linux File System and Basic Commands Linux File System and Basic Commands 0.1 Files, directories, and pwd The GNU/Linux operating system is much different from your typical Microsoft Windows PC, and probably looks different from Apple OS

More information

CS4350 Unix Programming. Outline

CS4350 Unix Programming. Outline Outline Unix Management Files and file systems Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission

More information

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou EECS 2031 - Software Tools Lab 2 Tutorial: Introduction to UNIX/Linux Tilemachos Pechlivanoglou (tipech@eecs.yorku.ca) Sep 22 & 25, 2017 Material marked with will be in your exams Sep 22 & 25, 2017 Introduction

More information

Basic Linux Command Line Interface Guide

Basic Linux Command Line Interface Guide This basic Linux Command-Line Interface (CLI) Guide provides a general explanation of commonly used Bash shell commands for the Barracuda NG Firewall. You can access the command-line interface by connecting

More information

Exam Linux-Praxis - 1 ( From )

Exam Linux-Praxis - 1 ( From  ) Exam Linux-Praxis - 1 ( From http://www.linux-praxis.de ) (1)Which of the following commands results in mailing the content of the current directory to Bob? A. mail Bob < ls B. ls > mail Bob C. ls mail

More information

A Brief Introduction to the Linux Shell for Data Science

A Brief Introduction to the Linux Shell for Data Science A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like

More information

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control Version 1.0, Last Edited 09/20/2005 Name of Students: Date of Experiment: Part I: Objective The objective of the exercises

More information