Linux commands practice
You try the most used Linux commands one by one and combine them in a real admin task at the end of each section.
Level 101 · 28 lessons · 30 practice labs
Lessons
Navigation and folders
- Listing with ls: hidden files, size and date: Using ls options you reveal hidden files, sizes and modification dates, and put the newest file on top.
- Knowing your place and switching directories with pwd and cd: You confirm your location with pwd and jump between absolute and relative paths with cd.
- Building nested folder structures with mkdir: With mkdir -p you build a multi-level folder structure in one command and create it with the right permissions.
- Practice: build an audit folder skeleton with mkdir and ls: You set up evidence, report and tool folders for a security audit and verify the layout with ls.
File operations
- Copying with cp: keeping permissions and dates: You copy files and folders with cp and use -a to back them up without losing permissions or dates.
- Moving and renaming with mv: You move and rename files with mv and use -i and -n to avoid overwriting existing files.
- Deleting safely with rm: -i, -r and mistakes you cannot undo: You delete files and folders with rm and build checking habits that prevent mistakes you cannot undo.
- Practice: tidy a messy shared folder with cp, mv and rm: You sort a messy shared folder by type, back up old copies and safely remove what is not needed.
Reading files
- Reading files with cat, more and less: You read short files with cat and page through long logs with more and less, searching inside less.
- Seeing the start, the end and the live stream with head and tail: You take the start and end of a file with head and tail, and watch a log live with tail -f.
- Numbering lines with nl: You number lines with nl so a report or incident note can point to an exact line.
- Practice: flag suspicious lines in a login log with less, tail and nl: You review the latest login log entries, note suspicious attempts with line numbers and write a short report.
Finding and searching
- Finding where a command really lives with which and whereis: With which and whereis you find which file a command runs from and learn to notice fake copies.
- Searching by name, size, date and permission with find: You use find to locate files by name, size, modification date and permission, then act on the results.
- Pattern searching with grep: -i, -r, -n and -v: You search text in files and folders with grep, ignore case and filter out lines that do not match.
- Practice: find world-writable files and exposed passwords with find and grep: With find and grep you list files with risky permissions and settings files holding plain-text passwords.
Text processing
- Counting and slicing columns with wc and cut: You count lines and words with wc and pull the column you need from logs and CSV files with cut.
- Sorting and counting repeats with sort and uniq: With sort and uniq you sort lists, count repeats and bring the most frequent entries to the top.
- Translating and deleting characters with tr: You change case, swap separators and strip unwanted characters with tr.
- Comparing two files with diff: You read diff output and find lines added or removed between two configurations or user lists.
- Merging two lists on a shared field with join: With join you match two lists, such as users and departments, on a shared column into one table.
- Building commands from a list with xargs: You feed one command’s output as arguments to another with xargs and handle names with spaces safely.
- Selecting, filtering and summing fields with awk: You split lines into fields with awk, filter by condition and compute column totals or averages.
- Practice: a department report from a staff list with cut, sort, uniq and awk: From a staff file you produce a short report with headcount per department and a list of privileged accounts.
System resources
- Watching CPU and memory with top and free: You read the heaviest process in top and available memory in free, telling normal from abnormal.
- Checking disk space and big folders with df and du: You see which disk is filling with df, find the folder taking the space with du and sort by size.
- Measuring how long a command takes with time: You read real, user and system times in time output and measure which of two methods is faster.
- Final task: diagnose a slow server with df, du, top and find: You find the full disk, the growing file and the process causing load, and report findings with your commands.
Practice labs
- Find the newest log file: Sort the log directory by date and submit the name of the most recently changed file.
- Find the largest hidden file: Sort the hidden files in the shared folder by size and submit the largest one's name and size.
- Build an audit folder skeleton in one command: Create the given year, month and department folders in one command with mkdir -p and brace expansion.
- Copy while keeping dates: Copy the reports folder to the archive directory keeping modification dates and permissions.
- Fix badly named files in bulk: Rename invoice files containing spaces and capitals to the required naming pattern with mv.
- Tidy a messy shared folder: Move the shared folder's files into subfolders by type and delete duplicate copies and empty files.
- Spot large, old files: Use find to locate files older than a month and above a given size and submit how many there are.
- List world-writable files: Use find to locate world-writable files in the application directory and write the list to the answer file.
- Delete only the old temporary files: Delete only the .tmp files in the temp directory, leaving files with spaces in their names and other files intact.
- Find which program really runs: Use which and whereis to find the file the python command runs and submit its full path.
- Find the alias and function shadowing a command: Use type -a to see why ls runs with unexpected options; find the alias and the shell function in the way and write down which one runs first.
- Prove which of three same-named programs runs: List three backup programs of the same name on PATH with which -a, compare their versions by full path, clear the shell's remembered old location with hash -r and report the full path of the one that runs.
- Measure how long a command takes: Run the command that compresses the archive directory under time and write the real, user and system times to the answer file.
- Measure which of two methods is faster: Run the same search with two different commands under time and report which is faster, with the timings.
- Explain the timing gap between first and later runs: Time the same search over a large directory three times in a row, show why the first run is slow by comparing real time with CPU time, and report the average as a fair measurement.
- List the files in a tree that mention a word: Use grep -rl to find the files in the scripts directory that mention the old server name and write the list to the answer file.
- Narrow a recursive search by file type: Use grep -rn to search only .conf files, skipping the backup directory with --exclude-dir, for a debug setting left on and save the file names with line numbers.
- Hunt for exposed passwords: Use grep -rn to find lines with passwords in the project tree, rule out sample files and report the real leak.
- Find the last error in a log: Inspect the end of the application log with tail and submit the last error line recorded.
- Find the suspicious line's number: Number the login log with nl and submit the line number of the first successful root login.
- Extract a record from the middle of a big file: Combine head and tail to extract the requested line range from a big dump file into a separate file.
- Count departments in a staff list: Cut the department column from the staff CSV and count how many people are in each department.
- Merge two lists on a shared field: Join the user and department lists and separately list the users with no department.
- Total the cost per department: Use awk to total each department's spend in the expense file and submit the department with the highest total.
- Clean broken line endings with tr: Strip the carriage returns from an address list that came from Windows with tr and save the clean file.
- Process files from a list with xargs: Process the approved deletion list with xargs so files with spaces in their names are removed correctly too.
- Report the difference between two user lists: Compare yesterday's and today's user lists with sort and diff and report the added and removed accounts.
- Find the directory filling the disk: Use df to find the full partition and du to find the largest directory, then submit its path.
- Find the process eating the CPU: Use top to find the process using the most CPU and submit its owner and PID.
- Find why the server is slow: Use df, du, top and find to work out why the server is slow and report the process or file causing it.
About this course
You try the most used Linux commands one by one and combine them in a real admin task at the end of each section.
What you will learn
- Navigation and folders
- File operations
- Reading files
- Finding and searching
- Text processing
- System resources
Prerequisites
No prior knowledge is needed; the course starts from zero.
Lab environment
Lessons run in your own Kali Linux terminal that opens in the browser. Nothing to install; the lab starts clean in every lesson.
Frequently asked questions
- Is this course right for my level?
- The course is at beginner level; every term is explained where it first appears.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.