What you will learn
- pwd, ls, cp, mv, rm, find and grep
- chmod (read 4, write 2, execute 1) and chown
- Why to use sudo instead of the root account, and apt vs dnf
- top, ps, df, du, mount, fsck, ip, dig, curl and nano
- /etc/passwd, shadow, hosts, fstab and resolv.conf
PRACTICE TESTS
Ready to drill it?
Practice tests for CompTIA A+ Core 1 and Core 2, every answer explained and checked against published sources. $19.95 for 30 days, plus sales tax where it applies; one payment, nothing renews.
See the 30-day passChapters
Exam objectives covered
- Core 2 (220-1202) objective 1.9, Operating Systems
Transcript
Read the full lesson narration
File management
Linux runs most of the world's servers, and plenty of desktops too. Most of the work happens in a terminal. Here are the commands and files CompTIA expects you to know.
Start with files. pwd prints the folder you're in, and ls lists what's there; ls dash l adds permissions and owners. cp copies, mv moves or renames, and rm removes, with no recycle bin to save you. find searches for files by name, and grep searches inside files for text.
Permissions: chmod and chown
Permissions come in three kinds, read, write, and execute, for three classes: the owner, the group, and others. chmod changes them. Read is four, write is two, execute is one, so chmod seven five five gives the owner full control, and the group and others read and execute. chown changes the owner and group, like chown jsmith colon accounting.
Root, sudo, su, apt and dnf
Administrative work. The root account can do anything, so don't sign in as root. Instead, sudo runs one command as root, after you confirm your own password, and su switches to another user, root by default, with that user's password. Software comes from a package manager: apt on Debian and Ubuntu, dnf on Fedora and Red Hat. For example, sudo apt install, then the package name; scripts often use apt-get install.
man, cat, top, ps, df, du, mount, fsck
To look around, man shows a command's manual, and cat prints a file. top shows live processes and their CPU and memory use, while ps lists the processes at one moment. df shows free space on each filesystem, and du shows how much space a folder uses. For disks, mount attaches a filesystem to a folder, and fsck checks and repairs one while it's unmounted.
ip, ping, traceroute, dig, curl, nano
Networking. ip addr shows your addresses, replacing the older ifconfig. ping tests whether a host answers, traceroute shows the path, dig asks DNS for a name's address, and curl fetches a web address from the command line. And to edit a text file right in the terminal, use nano, a simple editor.
The /etc files, kernel, bootloader, systemd
A few files in the /etc folder matter. passwd lists the user accounts, and shadow holds the password hashes, which ordinary users can't read. hosts maps names to addresses before DNS is asked. fstab lists the filesystems to mount at boot, and resolv.conf names the DNS servers. Under the hood, the bootloader, usually GRUB, loads the kernel, the core of the system, and systemd starts and manages the services.
Quick drill and recap
Drill time. Say the answer before I do. Which command shows the folder you're in? pwd. Give the owner full control, and everyone else read and execute? chmod seven five five. Install a package on Ubuntu? sudo apt install. Which file holds the password hashes? The shadow file. Search inside files for a word? grep.
Lock in these four. One. Files: ls, cp, mv, rm, find, and grep, with chmod and chown for permissions. Two. Use sudo instead of signing in as root, and install with apt or dnf. Three. top, ps, df, du, and man to look around; ip, ping, dig, and curl for the network. Four. In the /etc folder: passwd, shadow, hosts, fstab, and resolv.conf.
That's Linux. Now go prove it. Practice questions are waiting for you in Drill Sergeant.
PRACTICE TESTS
Ready to drill it?
Practice tests for CompTIA A+ Core 1 and Core 2, every answer explained and checked against published sources. $19.95 for 30 days, plus sales tax where it applies; one payment, nothing renews.
See the 30-day passRelated lessons
Found a mistake in a lesson? Email support@drillsgthq.com with the lesson and what is wrong.
Drill Sergeant is an independent study resource. It is not affiliated with, endorsed by, or sponsored by CompTIA, Inc. CompTIA and A+ are trademarks or registered trademarks of CompTIA, Inc.