1.9 Identify common features and tools of the Linux client/desktop operating system.
📘CompTIA A+ Core 2 (220-1202)
Linux File Management for the CompTIA A+ Exam
Linux is widely used in servers, desktops, and embedded systems. One key skill is managing files and directories using the command line. Here’s what you need to know about the most common commands:
1. ls – List files and directories
- Purpose: Displays files and folders in the current directory.
- Basic syntax:
ls
- Common options:
ls -l→ Shows detailed info (permissions, owner, size, date modified).ls -a→ Shows hidden files (files starting with.).ls -lh→ Human-readable sizes in long listing.
IT example:
- A sysadmin checks what files are in
/etcto verify configuration files.
ls -lh /etc
2. pwd – Print Working Directory
- Purpose: Shows the full path of the current directory you are in.
- Syntax:
pwd
IT example:
- You are logged into a remote server and want to confirm your location before editing files.
3. mv – Move or Rename files
- Purpose: Moves files or directories from one location to another or renames them.
- Syntax:
mv [source] [destination]
IT examples:
- Move
report.txtto/home/user/docs/
mv report.txt /home/user/docs/
- Rename
oldname.txttonewname.txt
mv oldname.txt newname.txt
4. cp – Copy files or directories
- Purpose: Copies files or directories to another location.
- Syntax:
cp [source] [destination]
- Options:
cp -r→ Copy directories recursively.cp -i→ Ask before overwriting existing files.
IT example:
- Backup a configuration file before making changes:
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
5. rm – Remove files or directories
- Purpose: Deletes files or directories. Be careful – this is permanent unless using a system with recovery.
- Syntax:
rm [file]
- Options:
rm -r→ Remove directories recursively.rm -f→ Force delete without asking.
IT example:
- Remove an old log file to free disk space:
rm /var/log/oldlog.log
6. chmod – Change file permissions
- Purpose: Changes the read, write, and execute permissions of files or directories.
- Syntax:
chmod [permissions] [file]
- Permissions format:
r= readw= writex= execute
- Numeric method:
4→ read2→ write1→ execute- Example:
chmod 755 script.sh- Owner: read/write/execute
- Group & Others: read/execute
IT example:
- Make a deployment script executable by all users:
chmod 755 deploy.sh
7. chown – Change file owner or group
- Purpose: Changes the owner or group of a file/directory.
- Syntax:
chown [owner][:group] [file]
IT example:
- Assign a file to a new owner
adminand groupstaff:
chown admin:staff server.log
8. grep – Search for text in files
- Purpose: Searches for specific text patterns inside files.
- Syntax:
grep [options] "pattern" [file]
- Options:
-i→ Ignore case-r→ Search recursively in directories-n→ Show line numbers
IT example:
- Find all lines containing “ERROR” in a log:
grep "ERROR" /var/log/syslog
9. find – Locate files and directories
- Purpose: Searches for files and directories based on name, type, size, or other attributes.
- Syntax:
find [path] [criteria]
- Common examples:
find /home -name "*.txt"→ Find all.txtfiles in/home.find /var/log -type f -size +10M→ Find files larger than 10 MB in/var/log.
IT example:
- Locate a backup file created yesterday:
find /backups -name "backup-20260121.tar.gz"
✅ Exam Tips
- Understand command purposes – don’t just memorize syntax. Know the difference between
mvandcp. - Options matter – most commands have flags like
-ror-i. The exam may ask what a command does with certain options. - Permissions & ownership –
chmodandchownare frequently tested concepts. - Searching files –
grepandfindare essential for troubleshooting logs and configuration in Linux.
