Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linux Overview.

Similar presentations


Presentation on theme: "Linux Overview."— Presentation transcript:

1 Linux Overview

2 Outline Linux file system (FS) Linux vs. Windows
Useful commands for manipulating the FS Linux vs. Windows What did you learn from Assignment #1 sudo Apt-get Pipes Command prompt

3 Linux Filesystem Everything is a File

4 Linux Filesystem Filesystem is a method for storing and organizing computer files and the data they contain to make it easy to find and access. Different operating systems normally use different file systems.

5 Linux Filesystem The filesystem in Linux stores the kernel
the executable commands supported by the OS configuration information user data and special files that are used to give controlled access to system hardware and OS functions.

6 Linux Filesystem Items stored in the filesystem are of four types:
Ordinary files contain text, data, or program information. Files can not contain other files or directories. Directories containers that hold files, and other directories. Devices are used in the same way as ordinary files providing applications with easy access to the hardware devices. Links which is a pointer to another file

7 Linux Filesystem The system is laid out as a hierarchical tree structure. The top-level directory is the 'root' designated by a slash '/'. Each directory can have many child directories, but only one parent directory.

8 Linux Filesystem

9 Linux Filesystem The path to a certain location can be specified as:
Absolute path from root e.g. /root/home/will Relative path Accessing play from user “zeb” ../will/play

10 Root Common Subdirectories

11 Common Subdirectories
Directory Stands for Content / root Top-level directory in the hierarchical tree /bin Binaries Contains binaries used by both the system administrator and non-privileged user e.g. command ‘ls’ is stored here /dev Devices Contains hardware devices directories. It is a virtual directory /etc Et cetra Contains configuration files for running applications /home Contains user subdirectories /lib Libraries Contains shared libraries e.g. C, Perl, Python general libraries /mnt Mount /proc Processes Contains information about the system e.g. process that are running. It is a virtual directory /root Default home directory for the system administrator. Isolated to increase security

12 Common Subdirectories
Directory Stands for Content /sbin Secure Binaries Contains secured binaries that are only accessed by privileged users e.g. fdisk, partitioning tool is kept here /tmp Temporaries Contains temporary files /usr Unix System Resources Contains subdirectories such as /usr/doc which contains system documentations, /usr/local the local hosts directory /var Variables Contains log and spool files /boot Contains Linux kernel

13 Useful Commands

14 CD $ cd path changes your current working directory to path (which can be an absolute or a relative path). One of the most common relative paths to use is '..' (i.e. the parent directory of the current directory). $ cd  resets your current working directory to your home directory (useful if you get lost). $ cd -  If you change into a directory and you subsequently want to return to your original directory, use

15 pwd pwd - Displays the current directory ("working directory").
pwd displays the full absolute path to your current location in the filesystem. $ pwd      /usr/bin implies that /usr/bin is the current working directory.

16 Filesystem Comparison
Linux vs. Window

17 Filesystem Comparison
Linux Filesystem Windows Filesystem Hierarchal Structure Only a single hierarchal directory structure. Everything starts from the root directory and then expanded to subdirectories. It also has various partitions, but under the root directory. They are ‘mounted’ under specific directories (Unified scheme) Various partitions, with directories under those partitions (Volume based file hierarchy) Detection Partition will not be detected unless it has been mounted. All partitioned detected and booted, then each assigned a drive letter. Crossover Can read/write FAT16 , FAT32 Can not unless with third party support Hidden Files Implement with a name that starts with a dot. Tracks it as a file attribute Types ext2, ext3 FAT12, FAT16, FAT32, and or NTFS

18 Filesystem Comparison
Linux Filesystem Windows Filesystem Case Sensitivity Case sensitive. File.txt is not the same as file.txt Not case sensitive Confirmation Messages Non existent e.g. when deleting, user will not be promoted whether to continue with the operation or not User will be prompted with each action Search Path Does not look into the current directories. It looks at the PATH environment variable. To run program in current directory: ./ program Checks current directory first then looks at the PATH environment variable Slashes Uses a forward slash “/” Uses a backward slash “\” Switch Indication Switches are preceded by “-” Switches are preceded by “\”

19 Default Directory The default working directory is your user home directory. /home/ubuntu /home is equivalent to My documents User name

20 Running Privileged Commands
How to run privileged commands as a normal user? Use sudo command Sudo is a program which can be used by normal users to execute as super users or any other users.

21 Running Privileged Commands Example
Running the following statement sudo –l Then entering password will produce a listing of command that the user may execute as well as how and as who they maybe executed.

22 Beware of the dark side of root
root user privileges are only needed for very specific tasks with security risks: mounting, creating device files, loading drivers, starting networking, changing file ownership, package upgrades... Even if you have the root password, your regular account should be sufficient for 99.9 % of your tasks (unless you are a system administrator). In assignments, it is acceptable to use root. In real life, you may not even have access to this account, or put your systems and data at risk if you do.

23 Using the root account In case you really want to use root...
If you have the root password: su - (switch user) In modern distributions, the sudo command gives you access to some root privileges with your own user password. Example: sudo mount /dev/hda4 /home

24 Live process activity top - Displays most important processes, sorted by cpu percentage top - 15:44:33 up 1:11, 5 users, load average: 0.98, 0.61, 0.59 Tasks: 81 total, 5 running, 76 sleeping, 0 stopped, 0 zombie Cpu(s): 92.7% us, 5.3% sy, 0.0% ni, 0.0% id, 1.7% wa, 0.3% hi, 0.0% si Mem: k total, k used, k free, k buffers Swap: k total, k used, k free, k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3809 jdoe R :21.49 bunzip root m 80m 90m R :21.01 X 3006 jdoe m 27m S :22.40 kdeinit 3008 jdoe S :06.59 autorun 3034 jdoe m 24m S :12.68 kscd 3810 jdoe R :00.06 top You can change the sorting order by typing M: Memory usage, P: %CPU, T: Time. You can kill a task by typing k and the process id.

25 Updating and installing packages
Debian-based distros use a software installer called apt-get, which uses the Debian dpkg system to retrieve, unpack, and install software. Apt-get is the command you use to get that software. Synaptic is the GUI for apt-get

26 Pipes Unix pipes are very useful to redirect the standard output of a command to the standard input of another one. Examples cat *.log | grep -i error | sort grep -ri error . | grep -v “ignored” | sort -u \ > serious_errors.log This one of the most powerful features in Unix shells!

27 Command prompt User_name@device_name:~$
Use UP arrow key to invoke previous commands Use TAB to auto-complete commands

28 Conclusion You need to know the difference between relative and absolute path when dealing with Linux directories You need to know how Linux FS is different from Windows FS You need to know when to switch to super user privileges

29 References The basic similarities between Linux and DOS
Introduction to Unix Windows-to-Linux Roadmap


Download ppt "Linux Overview."

Similar presentations


Ads by Google