Performing Basic Linux Tasks
• Identify the Linux Design Philosophy
• Enter Shell Commands
• Get Help with Linux
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 1
Open Source Software (OSS) (Slide 1 of 2)
Computer code that any user is permitted to view, copy, and modify for
any reason, as well as distribute to anyone.
• Users are granted rights when author releases source code under an OSS license.
• Opposite of proprietary software.
• Released under a license that restricts rights.
• Provides several advantages.
• Encourages ongoing improvement of software.
• Encourages collaboration and community-driven development.
• Developers can customize/enhance others' code.
• No legal issues.
• The Linux kernel is OSS.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 2
Open Source Software (Slide 2 of 2)
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 3
Free Software vs. Open Source Software (Slide 1 of 2)
• Free software often conflated with OSS.
• Very similar with a lot of overlap.
• Some draw a distinction.
• According to Richard Stallman:
• "Open source is a development methodology; free software is a social movement."
• OSS focuses on collaborative development.
• Free software focuses on user rights.
• "Free" as in freedom, not a lack of cost.
• Free and open source software (FOSS):
• Used as an alternative term.
• Embodies values of both movements.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 4
Free Software vs. Open Source Software (Slide 2 of 2)
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 5
The Unix Philosophy
A set of best practices and approaches to software
development.
• Emphasizes simplicity and modularity.
• Created by lead Unix developers.
• Key high-level points:
• Do one thing and do it well.
• Worse is better.
• Support interactivity.
• Handle I/O streams.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 6
Advantages of Using Linux
• FOSS nature promotes transparency.
• Design emphasizes simplicity and modularity.
• Highly customizable.
• Highly reliable and stable.
• Strong integration with common programming languages.
• Emphasis on security and privacy.
• Most distributions are free of monetary cost.
• Has a passionate community that offers support.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 7
Disadvantages of Using Linux
• Sharper learning curve.
• Desktop software is not as well-supported.
• No official version; might confuse new users.
• No official support for the most part.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 8
Linux Distributions
Distinct members of the Linux OS family.
• No official "Linux" OS.
• All distros (Linux Distribution) based on Linux kernel.
• Different distros have different additional software and kernel version.
• Kernel + additional software = fully functional OS.
• Also differences in community, release rate, etc.
• Choosing a distro is a matter of:
• Identifying your business needs.
• Familiarity with provided tools.
• There are hundreds of distros.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 9
List of Linux Distributions (Slide 1 of 2)
Distro Notes
• Oldest distro still maintained.
Slackware
• Most Unix-like, for advanced users.
• Earlier distro composed entirely of free software.
Debian
• Basis for many derivative distros.
• One of the most popular distros for general use.
Ubuntu
• Based on Debian.
• Debian-based distro.
Kali Linux
• Used in penetration testing/other cybersecurity tasks.
• Comes with paid customer support.
RHEL
• Common for servers in corporate environments.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 10
List of Linux Distributions (Slide 2 of 2)
Distro Notes
• No-cost version of RHEL.
CentOS
• Same functionality, no support provided.
• Upstream source of RHEL.
Fedora
• Multiple editions targeting different computing roles.
• Sponsored by SUSE Linux GmbH.
openSUSE
• Incorporates FOSS tools.
• Shares code base with openSUSE.
SLES
• More stable, comes with paid customer support.
• For experienced users; emphasizes simplicity.
Arch Linux
• ArchWiki provides comprehensive documentation.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 11
Uses for Linux
Role Description
• Provide services to multiple users over a network.
Servers
• Linux dominates web, cloud, and other server markets.
• Powerful desktops geared toward technical use.
Workstations
• Slightly better Linux adoption than PCs.
• Mainframes excel at processing concurrent transactions.
Mainframes and
• Supercomputers excel at performing complex calculations quickly.
supercomputers
• Linux dominates both markets.
• Includes smartphones, tablets, etc.
Mobile devices
• Android has over 80% of mobile device market.
• Includes desktops and laptops.
PCs
• Only around 2% run Linux.
• Have specific functions in a larger system.
Embedded systems
• Majority of market runs Linux.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 12
The Command-Line Interface
A text-based interface between the user and the OS that accepts
input in the form of commands.
• Presents prompt to user.
• User enters command to interact with system.
• Important tool in any admin's arsenal.
• Developers and admins use CLI, end users tend to use GUI.
• Comfort at CLI is essential, and an assumed skill.
• A GUI is not required, and may not even be installed.
• You can perform all administration at the CLI.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 13
CLI Advantages and Challenges
• Advantages:
• Faster for system to process.
• Faster for admins to enter info.
• Commands can be stored as scripts to run a series of tasks.
• Scripts can be scheduled to run on a regular basis.
• Additional options available that may not be in GUI.
• Challenges:
• More difficult to learn than GUI.
• Commands have many options and are not always consistent.
• Often mistakenly thought of as legacy.
• Many command-line environments in different OS platforms.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 14
Shells (Slide 1 of 2)
A system component that permits users to pass commands and
information to the kernel.
• Interpreter between human and kernel languages.
• Users issue commands in shell to tell OS what to do.
• OS responds with results.
• Can be either CLI or GUI.
• CLI shells:
• Bourne shell
• Bash
• C shell
• KornShell
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 15
Shells (Slide 2 of 2)
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 16
Bash Syntax (Slide 1 of 2)
• Basic syntax: command [-options] [arguments]
Syntax Format Command Description
Command only ls Lists directory contents with default output.
Lists directory contents in long format/shows hidden
Command with options ls –la
files.
Lists directory contents of /var/log with default
Command with argument ls /var/log
output.
Command with options and Lists directory contents of /var/log in long
ls –la /var/log
argument format/shows hidden files.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 17
Bash Syntax (Slide 2 of 2)
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 18
Basic Bash Commands
Command Description Examples
echo Repeats input back to user. echo 'Good morning!'
• ls
• ls -a
ls Lists contents of directory.
• ls -l
• ls /var/log
pwd Displays current working directory. pwd
• cd /var/log
cd Changes current working directory.
• cd /etc
touch Updates timestamp of file/creates file. touch file1
cp Copies a file or directory. cp file1 file2
mkdir Creates a new directory. mkdir newdir
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 19
File Viewing Commands
• System configs are in text files.
• cat views contents of file.
• Example: cat file1 shows contents of file1 on screen.
• less breaks output into pages.
• Example: less file1 shows contents even if they go past screen.
• Press Page Up/Page Down to scroll.
• Press q to exit.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 20
File Editing Commands
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 21
Power Management Commands
• shutdown -h now
• Shuts down with no delay.
• shutdown -h -t 90
• Shuts down in 90 seconds.
• shutdown -r now
• Reboots with no delay.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 22
Superuser Commands
• Superuser has admin credentials.
• Typically named root.
• Avoid logging in as root.
• Sometimes you'll need to assume superuser privileges.
• su – switches/substitutes user credentials.
• su - root switches/substitutes to root user.
• System will prompt you for root password.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 23
Shell History
• Bash keeps a history of commands entered.
• Use to repeat commands.
• Examples:
• history outputs list of recently entered commands.
• Up/Down Arrow keys cycle through history. Press Enter to reissue command.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 24
Tab Completion
A feature in which a command-line shell fills in the name of a
command you've partially typed.
• Supported by Bash.
• Reduces errors and speeds up entering commands.
• Examples:
• Type his and press Tab to fill rest of history command.
• Type cd /home/user1/Aug and press Tab to fill path to:
cd /home/user1/AugustProjects
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 25
Shell Tips and Tricks
• Get in the habit of using tab completion.
• Use history instead of re-writing long commands.
• Read the command backward to troubleshoot issues.
• Clear the screen with the clear command.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 26
Linux Documentation
• Documentation is a necessity.
• Helps users perform activities and resolve issues.
• Any job role or experience level.
• No official comprehensive source of Linux documentation.
• Spread across multiple sources in multiple forms.
• Example sources:
• Manual pages
• Built-in help commands
• Online documentation projects
• Usenet newsgroups
• Internet mailing lists
• Q&A websites
• Forums/social media
• Books/other print resources
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 27
Manual Pages (Slide 1 of 2)
The complete documentation for specific Linux commands.
• Available on Linux systems by default.
• Use the man command to display pages.
• Include information such as:
• Syntax
• Description
• Options
• Example usage
• Related commands
• Most immediate source of help for commands.
• Useful when you have no Internet access.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 28
Manual Pages (Slide 2 of 2)
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 29
Other Built-In Help Options
Help Option Description
• Searches NAME section of man pages based on keyword.
apropos • Helps you find the right command to use for a certain task.
• Syntax: apropos {keyword}
• Displays brief description of given command.
whatis • Helps you figure out what a command does.
• Syntax: whatis {command}
• Displays info page of command.
• Similar to man pages, with some improvements.
info
• Not as widely adopted as man pages.
• Syntax: info {command}
• Displays quick summary of command usage and arguments.
--help
• Syntax: <command> --help
• Directory of documentation for software packages.
/usr/share/doc/
• Includes author, licensing, installation, README, etc.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 30
Online Documentation (Slide 1 of 2)
Online Source Description
Official distro • Some distros provide official documentation for that distro.
documentation • Includes release notes, installation guide, etc.
• All-volunteer project for comprehensive Linux documentation.
LDP
• Provides HOWTOs, Guides, FAQs, man pages, etc.
Linux man-pages • Official man pages for Linux kernel/C library function interfaces available to
project user space programs.
• Official source of documentation for GNU core utilities.
GNU coreutils manual
• coreutils is GNU software package compiled with Linux kernel.
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 31
Online Documentation (Slide 2 of 2)
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 32
Interactive Help
Online Source Description
• Online discussion similar to bulletin board systems.
Usenet newsgroups • Users post to group in threads.
• comp.os.linux.help, comp.os.linux.answers, comp.os.linux.admin
• Similar to newsgroups but threads are sent over email.
Mailing lists • Some distros have their own mailing lists.
• General mailing lists: https://lists.linuxfoundation.org/mailman/listinfo
• Users post questions and other users provide answers/comments.
Q&A websites • Posts are "liked" or "upvoted" by community.
• Example: https://unix.stackexchange.com/
• Threaded posts using web protocols.
• Some forums encourage questions and discussion on Linux topics.
Forums and social
• Example: https://www.linuxquestions.org/
media
• Social media sites can provide forum-like discussion platforms.
• Example: https://www.reddit.com/r/linuxquestions/
Copyright (c) 2019 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 33
The End
Any question.