Your SlideShare is downloading. ×
  • Like
UNIX/Linux training
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

UNIX/Linux training


Want to put your Unix/Linux skills on steroid? …

Want to put your Unix/Linux skills on steroid?
Contact me at 234-808-938-2423 or

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. UNIX/LINUX TRAINING Michael Olafusi +234-808-938-2423
  • 3. Introducing UNIX/Linux
  • 4. Linux and UNIX • Linux is an open-source clone of UNIX, the most secure and mature operating system. • The major difference between Linux and UNIX is that UNIX is trademarked to The Open Group, while Linux is Open- source. • All command line tools work the same on both. • Over 90% of the supercomputers in the world run Linux. And the 10 fastest run Linux. • Linux is the leading operating system on Servers • Linux is free and popular distributions (distros) are Ubuntu, Fedora/Red Hat, OpenSUSE, Mandriva, Mint, ArchLinux, Slackware…
  • 5. Benefits of UNIX/Linux • Low cost and very stable (some Linux servers are not rebooted for over a year, try that with Windows server!). • Best multi-user, multitasking OS. • Most secure OS. Hence, it’s popularity as a server OS. • Best computing power and inbuilt network support • Fastest developing OS, with the most number of developers.
  • 6. Linux Distributions • A Linux distribution consists of the Linux kernel (actual OS) and a collection of applications – Linux Kernel – X Window System – Graphical Desktops (GNOME, KDE…) – Applications • GNU Software is at the heart of every Linux. Besides the Linux Kernel, GNU software/utilities come next • GNOME and KDE are the most popular graphical desktops • Ubuntu, Mandriva, OpenSUSE, RoboLinux, Slackware, Xandros, Debian GNU, Fedora, Gentoo, Knoppix, Linspire
  • 7. Linux Installation
  • 8. Linux Installation • Similar installation process across all distros • Live CDs, to try the Linux without installing • Setting aside Space for Linux – Root folder, Home folder & Swap space • Most secure OS. Hence, it’s popularity as a server OS. • Burning the Linux ISO image on DVD or making a Bootable Flash Drive • Doing the actual installation (Ubuntu as sample)
  • 9. Linux Installation • Best Practice requires the following on separate partitions – Swap – / – / boot – /home – /usr – /opt – /var • This type of partitioning scheme comes in handy when you have problem with your hard disk • Swap partition is used to boost your computer memory and some applications require it, even the hibernate feature on Linux requires it. Rule of Thumb is to set at 2x the RAM
  • 10. Installing Ubuntu
  • 11. Installing Ubuntu – Beginning
  • 12. Installing Ubuntu – Linux File system
  • 13. Installing Ubuntu – Creating Account
  • 14. Installing Ubuntu - Completed
  • 15. Linux Desktops
  • 16. Linux Desktops • The most common Desktops are GNOME and KDE (just cosmetic differences and default programs) • Popular GNOME distros are Ubuntu & Fedora • Popular KDE distros are Kubuntu & OpenSUSE • Opening the Terminal Windows and 6 Virtual Consoles • Navigating the Linux File System • Linux Applications
  • 17. Linux File System
  • 18. Linux File Types • Ordinary files: These are regular files. (white/black) • Directories: These are files that contains other files and directories, and provide pointers to them. (blue) • Symbolic links: These special files link to another file, in a different location. (Cyan) • Block and character device files: All physical devices in Linux are represented by device files. e.g. /dev/sda (yellow) • Socket file: Provides protected inter-process networking. (Purple) • Named Pipe file: Like socket files but doesn’t use network socket semantics. (Red) • $ ls –l indicates all these types – -rw-r--r-- ordinary file – brw-rw---- block device file – crw-rw-rw- character device file – drwxr-xr-x directory file – lrwxrwxrwx symbolic file – srw-rw-rw- socket file – prw-rw-rw- named pipe file
  • 19. Linux/Unix Administration
  • 20. Linux Administration • Linux has become extremely easy to administer, compared to its early days. And can be administered using GUI applications (like Windows OS) or using the Commandline Interface (CLI) • As a professional Linux administrator, you’ll have to know how to administer the OS via the CLI • Linux supports multi-tasking, several users using the OS simultaneously. • By default 7 users can work simultaneously (without anyone logging out). 6 Commandline users and 1 GUI user. To switch use CTRL + ALT + F1 (F2,F3,F4,F5,F6,F7) . CTRL+ALT+F7 takes you to the GUI one • From the GUI, you can always access the commandline via “Terminal”
  • 21. Linux Administration
  • 22. Linux – User Administration • To show the Linux distro version: $ cat /proc/version • To see Linux kernel version: $ uname –r • To add new user: #useradd michael • To view the default useradd options: # useradd –D • The options are: – -g Group – -m Home directory – -f Inactive (to set password expiry date in days) – -e Expire (to disable the user after specified number of days) – -s Shell (user’s default login shell, usually /bin/sh) • To delete a user: # userdel –r michael
  • 23. Linux – CLI Key Combination • Ctrl + A to mover the cursor to the beginning of command line • Ctrl + C to end a running program and return the prompt • Ctrl + D to log out of the current shell session, same as exit or logout • Ctrl + E to move cursor to the end of the command line • Ctrl + H to generate backspace character • Ctrl + L to clear the terminal • Ctrl + R to search command history • Ctrl + Z to suspend a program • Shift + PageUp or PageDown to scroll (browse buffer) • Tab to autocomplete command of filename • Tab Tab to show command completion possibilities
  • 24. Linux CLI useful tips • If you can’t remember a command but remember the first 2 or more letters, type them and press Tab twice. This will list all the commands that start with those letters. • If you can’t remember how to use a particular command, type man command e.g. man mkdir to read a comprehensive help file on using the command, mkdir. • If you need a quick help with using the options or syntax of a command, type command --help (double hypen). e.g. mkdir - -help to get a quick help guide. • To get an easy to read manual (easier than man) on any command, type info command e.g. info mkdir • To get a short description of what a command does, type whatis command e.g. whatis mkdir • To get a list of commands for doing a particular task, type apropos task e.g. apropos text to get text manipulation commands/applications
  • 25. Linux CLI text manipulation • Use cat file.txt to display the content of file.txt on the screen • Use cat file.txt | more to display the content of file.txt one page at a time • Use cat file.txt | less to enable scrolling. Press q to exit/end. • Use tac file.txt to display the content of file.txt in reverse • Use cat file1.txt > file2.txt to copy content of file1 to file2, file duplication. • Use cat file1.txt >> file2.txt to append content of file1 to file2. • Use tail -10 file.txt to display the last 10 lines in file.txt • Use head -10 file.txt to display the first 10 lines in file.txt
  • 26. Linux CLI file permission • All files in Linux have permissions set (or unset) for user, group and other users. It’s indicated as –rwxrwxrwx or similar. • To display a file’s permission settings, type ls -l filename • The first character indicates the file type – ordinary file, directory… • The next 3 characters indicate the permission for the file owner (user), then next 3 for users in the owner’s group and the last 3 for other users. • r = Read w = Write x = Execute • Easiest way to change a file’s permission is to use chmod u/g/a +/- rwx filename e.g. chmod a+w file.txt to give everyone write permission on the file, file.txt • You can also use numeric arguments and common ones are – – chmod 400 to give only read permission to owner – chmod 600 to give read and write permission to owner – chmod 644 to give everyone read permission and the owner write permission – chmod 775 to give everyone read + execute, owner + group read write execute permission – chmod 777 to give everyone read write exceute permission
  • 27. Linux CLI execution modes • By default any command you run in the command line terminal runs in the foreground, and locks that particular terminal session till it finishes executing. • You can also make commands run in the background, so they don’t lock the terminal session and you can start other commands while they are still running. • To run a command in the background, type the symbol & after the command (put a space in between) • Only run commands that do not require user interaction in the background. • Type and execute jobs to show commands running in the background • Whenever you run a command in the background, it is assigned a process number, n. To refer to this (command execution) process, use %n. • To move a command process to the foreground, type fg %n (n is the command process number)
  • 28. Linux Administration - Performance • To a user, performance means quick execution of commands, while to a system administrator, it means ability to do much more. As the Administrator, you’ll have to optimize system performance for the whole system – users, programs and services. • Issues that can impair performance are – – programs that are not optimized for the system – problem with access to disks, controllers, display, other required interfaces – network issues affecting communication with out systems – amount of users working simultaneously on the system
  • 29. Linux Administration - Scheduling • There are times you will want a command or script to run at a particular time of the day or run while you are at lunch break. • Basically, there are three types of scheduling – – Using sleep to wait fore specified seconds before running the command. e.g. lp file1; sleep 900; lp file2; sleep 900; lp file3 (this is to insert 15mins between each file print, to allow other users print in between) – Using at command to run a command at a specified time. – Using cron to schedule a command or script on a monthly, weekly, daily or hourly basis
  • 30. Linux Administration – Output Redirection • Piping the output to another command using | • Redirecting output via > • Redirecting output via >> (to append) • Redirecting only errors via 2> • Redirecting standard input via < • Use tee option with | (pipe) to copy input to standard output (terminal) and more than one output files. e.g. cat original | tee copy1 copy2 • Use tee –a to append to files. e.g. cat file.txt | tee -a file_all.txt
  • 31. Linux Administration – Output Manipulation • Grep: It scans output line per line, searching for matching patterns. – All lines containing the pattern will be printed to standard output. e.g. cat countriesandcapitals.txt | grep Nigeria – This can be reversed using the –v option. • Sort: It allows you to sort the output lines before displaying. – Default is in alphabetical order. e.g. cat alphabets | sort – It can also sort by file size, when sorting ls output. e.g. ls ~/ -la | sort -nk 5 – And when used with uniq, it can sort and filter out double entries. e.g. sort itemlist | uniq
  • 32. Linux Administration – Vi(m) Editor • vi editor is a very powerful text editor that comes pre- installed on nearly all Linux OS. • vim is variant of vi editor, basically an improved version. Practically, it is more error tolerant than vi. • There are two modes – – Command mode, which is the default mode. You basically scroll through the file content or enter commands. • h moves the cursor to the left, • l moves it to the right, • k to move up, and • j to move down • dd will delete current line • :w to save (write) the changes made • :q will exit the editor • :q! will exit the editor without saving changes
  • 33. Linux Administration – Vi(m) Editor contd – Text input mode. You enter this mode by pressing the Insert key. There are some basic guidelines to note - • don’t attempt to scroll or change the cursor position in this mode, position the cursor where you want to add extra text before changing to the text input mode. The only exception is when you are using vim. • To change to this mode pressing - – a will append, move the cursor one position to the right before switching to the inserting mode – i will insert – o will insert a blank line under the current cursor position and move the cursor to that line • Vim is better, just not as pre-installed on Linux OSs as Vi. • Run vimtutor to start a recommended 30 minutes tutorial on using vim.
  • 34. Linux Administration - Commands man any_command <To view the manual for target command> pwd <Print current working directory> ls <Show files in current directory> ls –a <Show maximum information about all files, including hidden> mv source destination <Move/rename a file or directory> rm target <Delete target, could be file or directory> cp source destination <Copy file or directory> mount /dev/device_name /media/device_name <Mount filesytem> umount /media/device_name <Unmount> df –h <display all mounted filesystem and available disk space in KB, MB, GB> du <display disk usage, very useful for routine maintenance> ps – ef <List all running processes, with full details> top <Standard system monitor showing a more extensive view of all processes and system resources> nohup command & <Start a process in the background and have it keep running after you log off> ~/ <Current user's home directory> ifconfig <Configure network interfaces> iwconfig <Configure wireless network interfaces>
  • 35. Linux Administration - Commands ssh username@ip_address <Connect to a remote server> ping ip_address <Check to see if target is online and responding> traceroute6 ip_address <View network route to target> netstat <Network Monitor> iptables –L <View firewall rules> adduser <Create a new user> usermod <Change user privileges (be very careful with this one)> deluser <Delete user> chmod <# Change privileges over file or directory > chown user_name:group_name directory_name <Change owner of a file or directory> su username <Temporarily become a different user> users <Print usernames of logged in users> Infact, you can administer your mysql database directly from the CLI CREATE DATABASE databasename; <New database> CREATE USER username@localhost IDENTIFIED BY 'password'; <Create a new user> show tables; <Show database schema>
  • 36. Unix Command Utilities
  • 37. UNIX Utilities/Commands awk Processes files cat Displays files (and is used with other tools to concatenate files) cmp Compares two files comm Compares sorted files, and shows differences cp Copies files cpio Copies and backs up files to an archive cut Selects characters or fields from input lines dd Copies and converts input records diff Compares two text files, and shows differences dump Backs up files fdformat Formats a floppy disk at a low level file Displays the file type find Finds files within file tree fmt Formats text very simply grep Matches patterns in a file groff Processes embedded text formatting codes
  • 38. gzip Compresses or decompresses files head Displays the first part of a file (first 10 lines by default) ispell Checks one or more files for spelling errors less Displays files allowing for scrolling forward and backward (pauses when screen is full) ln Creates a link to a file lpr Sends a file to a printer or printer device ls Lists file and directory names and attributes man Displays documentation for commands mkbootdisk Creates a CD (or floppy disk on older distributions) from which to boot a system mkdir Creates a new directory mkfs Builds a UNIX/Linux file system mount Mounts file systems and devices mv Renames and moves files and directories newfs Creates a new file system (used in UNIX systems in particular) UNIX Utilities/Commands
  • 39. UNIX Utilities/Commands pr Formats text files for printing and displays them pwd Shows the directory you are in rdev Queries or sets the root image device restore Restores files (from a dump) rm Removes files rmdir Removes directories sed Edits streams (noninteractive) sort Sorts or merges files tail Displays the last lines of files (last 10 lines by default) tar Copies and backs up files to a tape archive touch Changes file modification dates uniq Displays unique lines of a sorted file wc Counts lines, words, and bytes whereis Locates information about a specific file
  • 40. UNIX Utilities/Commands pr Formats text files for printing and displays them pwd Shows the directory you are in rdev Queries or sets the root image device restore Restores files (from a dump) rm Removes files rmdir Removes directories sed Edits streams (non-interactive) sort Sorts or merges files tail Displays the last lines of files (last 10 lines by default) tar Copies and backs up files to a tape archive touch Changes file modification dates uniq Displays unique lines of a sorted file wc Counts lines, words, and bytes whereis Locates information about a specific file
  • 41. UNIX Utilities/Commands date Sets and displays date and time df Displays the amount of free space remaining on disk du Summarizes file space usage file Determines file type finger Displays detailed information about users who are logged in free Displays amount of free and used memory in the system edquota Displays user disk quotas and enables them to be changed kill Terminates a running process ps Displays process status by process identification number and name sleep Suspends process execution for a specified time top Dynamically displays the status of processes in real time uname Shows information about the operating system vmstat Shows information about virtual memory use w Displays detailed information about the users who are l ogged in who Displays brief information about the users who are logged in
  • 42. UNIX Utilities/Commands tp Transfers files over a network ifconfig Sets up a network interface netstat Shows network connection information nfsstat Shows statistics for Network File ping Polls another network station (using TCP/IP); great for a fast determination about whether your network connection is working rcp Remotely copies a file from a network computer rlogin Logs in to a remote computer route Displays routing table information, and can be used to configure routing rsh Executes commands on a remote computer showmount Lists clients that have mounted volumes on a server telnet Connects to a remote computer on a network traceroute Shows the route along a network between the source device and the destination, such as from a computer to a server wvdial Controls a modem dialer for dial-up connections over a phone line
  • 43. LINUX in a Network • Linux has the most robust networking tools and support • All the possible means of connecting to the internet work on Linux – Digital Subscriber Line (DSL) – Cable Modem – Dial-up Networking – Wireless Internet access points • Works seamlessly in a Local Area Network and has inbuilt security tools • Configurable network management files/tools, located in the /etc directory. • An arsenal of Network troubleshooting tools
  • 44. LINUX – Network Configuration • Linux network configuration files are – – /etc/hosts This contains addresses of hosts that can be contacted without using an external naming service like DNS. It always contains – /etc/resolv.conf This file configures access to a DNS server. It contains your domain name and the name server(s) to contact – /etc/nsswitch.conf This file defines the order in which to contact different name services. • Linux Network configuration commands include – – ifconfig to display and configure the network interfaces – ip is a newer and better command. Sample use include ip addr show and ip route show
  • 45. LINUX – Network Troubleshooting • Linux network commands are – – host to display information on hosts or domains. e.g. host – ping to check if a host is alive. You can interrupt by pressing Ctrl+C – traceroute to check the route that packets follow to a network host. e.g. traceroute – whois to lookup a specific domain information • In addition you can install several network troubleshooting and optimizing tools for free on Linux.
  • 46. Linux Internet
  • 47. LINUX and your Internet needs • Mozilla Firefox, Konqueror, Epiphany, Chromium and Opera Browser to access the web • Mozilla Thunderbird, Evolution, Zimbra, kontact and Kmail to do exactly what Outlook does • Graphical FTP clients like gFTP, KFTPGrabber and even Firefox, in addition to the commandline tool FTP • Linux can be configured as a Mail server, web server, FTP server, call manager, CMS server or Database server. And all without buying a complex expensive software.
  • 48. Linux Security
  • 49. Linux Security - Security Framework • Determine security requirements • Perform risk assessments • Establish a security policy • Implement a robust software + hardware security solution • Continuously monitor and manage the security solution
  • 50. Linux Security – Security Threats • Denial of Service attacks • Unauthorized Access • Unauthorized release of confidential information • Configuration loopholes • Network loopholes
  • 51. Linux Security – Security Solutions • Authentication • Access Control • Encryption • Password policies • Firewalls • Physical security of all hardware and data • Intrusion Prevention systems • Intrusion detection systems
  • 52. Linux Servers
  • 53. Linux Servers • Web server • FTP server • Mail server • DNS server • InterNetNews (INN) server • DB Server • SIP Server
  • 54. Linux Servers – File sharing • Network File System – For sharing files with other Linux/UNIX systems (or PCs with NFS client software) • Samba – For file sharing and print sharing Windows systems
  • 55. Linux Programming
  • 56. Linux Programming • Linux comes with software development tools pre-installed • Compiling source code applications • Shell Scripting – Most powerful tool of a Linux administrator – Used to automate routine administrative tasks – Used to monitor system performance and vital directories (especially database directories for enough free space) – Makes administration of lots of computers extremely easy and less error-prone
  • 57. Linux Programming – Shell Scripting • Bash shell scripts are the most used • A simple shell script is #!/bin/bash clear echo "Good morning, world.“ # save it as morning in any folder of choice e.g. ~/Documents # to run the script give it the executable file permission # using chmod 755 ~/Documents/morning # to run the script, type ~/Documents/morning
  • 58. Additional Online Resources • Introduction to Linux • Linux Newbie Administration Guide wbieAdministratorGuide.pdf • Bash Guide for Beginners • Ubuntu Pocket Guide & Reference .html
  • 60. CALL: +234-808-938-2423 E-MAIL: MICHAEL@OLAFUSIMICHAEL.COM