The Ultimate Guide to cat, less, and nano

The CyberSec Guru

Linux 101 - The Ultimate Guide to cat, less, and nano

If you like this post, then please share it:

Buy me A Coffee!

Support The CyberSec Guru’s Mission

🔐 Fuel the cybersecurity crusade by buying me a coffee! Why your support matters: Zero paywalls: Keep the content 100% free for learners worldwide, Writeup Access: Get complete writeup access within 12 hours of machine drop along with scripts and commands.

“Your coffee keeps the servers running and the knowledge flowing in our fight against cybercrime.”☕ Support My Work

Buy Me a Coffee Button

Welcome back to our Linux command-line journey! You’re staring at a blank terminal prompt. You know there are files in this directory—you’ve seen them with ls—but they’re just names. Black boxes. How do you see what’s inside? How do you read that README.txt? How do you check that error.log? And how do you change that config.ini file?

This is a fundamental barrier for every new Linux user. You’ve learned to navigate, but now you need to interact. In the world of Linux, where “everything is a file,” the inability to see and edit those files is like being in a library full of locked books.

Today, we’re not just giving you a key; we’re giving you a master set. We are going to explore, in exhaustive detail, the “Holy Trinity” of basic file interaction: cat, less, and nano.

  • cat: The simple, fast tool for a quick peek or for sticking files together.
  • less: The powerful “pager” that lets you navigate massive log files with ease.
  • nano: The friendly, simple text editor that lets you change files without a steep learning curve.

This isn’t just a brief overview. This is the ultimate, deep dive. By the end of this post, you will understand not just what these commands do, but why they exist, how to use their every feature, and when to choose one over the others. You will be able to confidently view, search, and edit files on any Linux system you encounter. Let’s unlock those books.

cat – The Concatenator

The first tool most users learn is cat. It’s simple, it’s fast, and its name is slightly misleading. cat stands for “concatenate,” which means to link things together in a chain. While it’s most commonly used to simply print the contents of a single file to the screen, its true, original purpose was to combine files.

Let’s explore every facet of this fundamental command.

cat Basic Syntax

The syntax for cat is as straightforward as it gets:

cat [OPTIONS] [FILE]...

  • [OPTIONS] are optional flags (which we’ll cover in detail) that modify the command’s behavior.
  • [FILE]... is the list of files you want it to act on. If no file is given, cat reads from “standard input” (your keyboard), a behavior we’ll explore.

Core Use Cases of cat (With Exhaustive Examples)

Let’s build from the ground up, starting with the simplest use and moving to cat‘s true power.

1. Viewing a Single, Short File

This is the most common, everyday use of cat. You have a file, story.txt, and you want to read it.

Command: cat story.txt

What Happens: cat reads the entire contents of story.txt and writes it to “standard output,” which is your terminal screen.

Example: If story.txt contains:

The quick brown fox
jumps over
the lazy dog.

The terminal will display:

$ cat story.txt
The quick brown fox
jumps over
the lazy dog.
$
Linux Cat Command
Linux Cat Command

The Critical Pitfall: What if story.txt wasn’t 3 lines long, but 3,000? cat would still read all 3,000 lines and dump them to your screen. The text would fly by, and you’d only see the last page of content. This is the primary weakness of cat for viewing files and the exact problem that less solves.

Rule of Thumb: Only use cat to view a file if you are sure it’s short (e.g., under 20-30 lines).

2. Viewing Multiple Files

This is where the “concatenate” name starts to make sense. You can give cat more than one file, and it will read them in order and print them all, one after the other.

Command: cat chapter1.txt chapter2.txt

Example: If chapter1.txt contains:

It was the best of times.

And chapter2.txt contains:

It was the worst of times.

The terminal will display:

$ cat chapter1.txt chapter2.txt
It was the best of times.
It was the worst of times.
$

The two files are “concatenated” to your screen.

3. Concatenating Files into a New File (The Real Power)

This is the true, intended purpose of cat. Using a shell feature called “output redirection,” we can tell the shell to send cat‘s output to a new file instead of the screen.

The > (greater-than) symbol is the redirection operator. It means “take all output from the command on the left and put it in the file on the right.”

Command: cat chapter1.txt chapter2.txt chapter3.txt > full_book.txt

What Happens:

  1. The shell sees > full_book.txt. It immediately creates full_book.txt (or truncates/erases it if it already exists. This is a critical warning!).
  2. cat runs. It reads chapter1.txt and sends its contents to the output.
  3. It then reads chapter2.txt and sends its contents to the output.
  4. It then reads chapter3.txt and sends its contents to the output.
  5. All of this output, instead of going to the screen, is redirected into the new full_book.txt.
  6. You will see no output on your terminal, just a new prompt. But if you now run cat full_book.txt, you’ll see the combined contents of all three chapters.
File Concatenation in Linux
File Concatenation in Linux

4. Appending to an Existing File

What if you don’t want to overwrite full_book.txt? What if you just want to add chapter4.txt to the end of it? For this, we use the “append” operator: >>.

Command: cat chapter4.txt >> full_book.txt

What Happens: The >> operator tells the shell to add the output to the end of the file, rather than overwriting it. If the file doesn’t exist, it will be created. This is much safer for adding data.

5. Creating Files (The cat > Trick)

This is a neat, old-school trick. If you run cat without a filename, it reads from standard input (your keyboard). If you combine this with redirection, you can create a file on the fly.

Command: cat > new_note.txt

What Happens: The terminal prompt will disappear. Your cursor will just sit on a blank line. You are now “in” cat. Start typing:

Hello world.
This is my new note.
I am typing this directly.

When you are finished, press Ctrl+D (holding Ctrl and pressing D). This sends the “End of File” (EOF) signal. cat will stop reading and exit. The shell will then give you a new prompt. If you now run cat new_note.txt, you’ll see the text you just typed.

This is fantastic for quick notes, test files, or pasting a snippet from your clipboard into a new file without opening an editor.

Appending with the same trick: You can also append from your keyboard: cat >> existing_note.txt …type more text… Ctrl+D The new text will be added to the end of existing_note.txt.

6. Combining with Other Commands (Piping)

cat is often used as the first command in a “pipeline” of commands, using the | (pipe) symbol. The pipe takes the output of the command on the left and “pipes” it as the input to the command on the right.

Command: cat system.log | grep "ERROR"

What Happens:

  1. cat system.log runs, reading the entire file and dumping its contents to its output.
  2. The | pipe intercepts that output.
  3. The grep "ERROR" command receives the full file contents as its input.
  4. grep then filters this input, line by line, and only prints the lines that contain the string “ERROR”.

The “Useless Use of cat” (UUoC) This is a famous topic in the Linux/Unix community. The command above: cat system.log | grep "ERROR" …is technically inefficient. It spawns an extra cat process just to dump a file. Most commands, including grep, are perfectly capable of reading files on their own: grep "ERROR" system.log

This second command does the exact same thing but is more efficient. It spawns only one process (grep) instead of two (cat and grep).

So why do people use cat | ...?

  1. Habit: It’s a simple, linear “left-to-right” way of thinking: “First, I get the file, then I filter it.”
  2. Readability: Some (not all) find it clearer to read.
  3. Flexibility: If you were- cating multiple files, the pipeline makes sense: cat file1.log file2.log | grep "ERROR".

While it’s good to know the more efficient way, the “Useless Use of cat” is not a high crime. It’s just a common “code smell” you’ll see in the wild.

cat‘s Exhaustive Command-Line Options

This is where cat gets more interesting. These flags give you powerful formatting abilities.

  • -n, --number: Number all output lines. This is incredibly useful. It adds a line number, a tab, and then the line’s content.Command: cat -n story.txt Output: 1 The quick brown fox 2 jumps over 3 the lazy dog.
  • -b, --number-nonblank: Number non-empty lines. This is often more useful than -n. It numbers the content lines but skips blank lines, making the numbering cleaner.Command: (Assuming story.txt now has a blank line)The quick brown fox jumps over the lazy dog. cat -b story.txt Output: 1 The quick brown fox 2 jumps over 3 the lazy dog. Notice the blank line is not numbered.
  • -s, --squeeze-blank: Squeeze multiple adjacent blank lines. If you have a file with sections separated by 5 or 6 blank lines, this flag will “squeeze” them down to a single blank line, making the output much more compact.Command: cat -s messy_file.txt
  • -E, --show-ends: Display $ at the end of each line. This is a fantastic debugging tool. Why isn’t your script working? Maybe you have trailing whitespace (spaces or tabs) at the end of a line. cat -E makes this invisible problem visible.Command: cat -E config.ini Output:port=8080 $ host=localhost $ user=admin$ $ You can immediately see that the host line has extra spaces at the end.
  • -T, --show-tabs: Display TAB characters as ^I. Another crucial debugging tool. In many files (like Python code or Makefiles), the difference between a Tab and Spaces is critical and invisible. This flag makes tabs visible.Command: cat -T script.py Output:def my_function():$ ^Iprint("Hello")$ You can now see that the indent is a tab.
  • -v, --show-nonprinting: Show non-printing characters. This is a catch-all for other invisible characters (like control characters) that might be corrupting your file.
  • -A, --show-all: The “show me everything” flag. This is the ultimate debugging flag. It is the same as running -vET. It will show non-printing chars (-v), tabs (-T), and line endings (-E). When a file is acting “weird,” cat -A is your first step.Command: cat -A mystery_file.txt Output:This^Ihas a tab $ and this has trailing space $ ^M$ and this has a weird windows line ending (the ^M).$

cat Gotchas and Summary

  • Gotcha 1: cat on Binary Files: Don’t do it. A binary file is a non-text file, like an image (.jpg), a program, or a compressed file (.zip). If you run cat my_program, it will spew thousands of lines of meaningless gibberish (control codes) to your terminal. This can, in some rare cases, mess up your terminal session (making text invisible or garbled). If you want to find text inside a binary file, use the strings command.
  • Gotcha 2: The cat file > file Trap:NEVER do this. cat somefile.txt > somefile.txt You might think this will… do nothing. Or maybe format it? WRONG. Remember: the shell processes redirection (>) first.
    1. The shell sees > somefile.txt and immediately truncates (erases) somefile.txt.
    2. The shell then runs cat on the now-empty somefile.txt.
    3. cat reads 0 lines from the empty file.
    4. The command finishes. You are left with an empty file. Your data is gone.

cat Summary:

  • Strengths: Simple, fast, great for viewing short files, and the standard tool for concatenating (combining) files. Its formatting options (-n, -E, -A) make it a powerful debugging tool.
  • Weaknesses: Useless (and annoying) for viewing large files.

And that weakness is the perfect-seque into our next tool.

less – The Pager

less is the tool you should be using 90% of the time you want to view a file. It is a “pager,” which means it lets you view a file “page by page” (or screen by screen). Its name is a classic programmer joke. The original Unix pager was called more (because it would show you “more” of the file, one page at a time). The new, more powerful version was named less, because… “less is more.”

less is superior to more because it doesn’t need to read the entire file into memory before displaying it. It can open a 10GB log file instantly. It also allows you to scroll backward as well as forward (which more couldn’t).

less Basic Syntax

less [OPTIONS] [FILE]

Just give it a file, and it will open. less /var/log/syslog

Linux syslog
Linux syslog

The less Interface: Essential Navigation

When you run less, your terminal screen is “taken over.” You are now in the less application. The most important command is q (for Quit). Just press q to exit and return to your terminal prompt.

Here are the essential keys for navigation. You can use either the “vi keys” (like j/k) or the arrow keys.

  • q: Quit. (The most important command).
  • Scrolling Line-by-Line:
    • j or Down Arrow: Scroll forward one line.
    • k or Up Arrow: Scroll backward one line.
  • Scrolling Page-by-Page:
    • f or Spacebar or Page Down: Scroll forward one full screen.
    • b or Page Up: Scroll backward one full screen.
  • Scrolling Half-a-Page:
    • d: Scroll forward (down) half a screen.
    • u: Scroll backward (up) half a screen.
  • Jumping to Start/End:
    • g or Home: Go to the very beginning of the file (line 1).
    • G or End: Go to the very end of the file.
  • Jumping to a Specific Line:
    • Type a number, then g. For example: 100g will jump to line 100.
    • Type a number, then %. For example: 50% will jump to the halfway-point of the file.
  • h: Help. This is your other best friend. Pressing h opens a full summary of all less commands, right inside less. Press q to exit the help screen.

Searching in less (Its Killer Feature)

This is what makes less so powerful for log files.

  • / (Forward Search):
    1. Press the / key.
    2. Your cursor will jump to the prompt at the bottom of the screen.
    3. Type your search term (e.g., Error) and press Enter.
    4. less will jump to the next occurrence of “Error” in the file.
    5. All matches will be highlighted.
Linux less Command
Linux less Command
  • ? (Backward Search):
    1. Press the ? key.
    2. Type your search term and press Enter.
    3. less will jump to the previous occurrence of that term.
  • n (Next Match):
    • After a search, press n to jump to the next match (in the same direction as your original search).
  • N (Previous Match):
    • Press N to jump to the previous match (in the opposite direction of your original search).
  • & (Filter / “Grep” mode):
    • This is an amazing, little-known feature.
    1. Press the & key.
    2. Type a pattern (e.g., sshd) and press Enter.
    3. less will hide all lines that do not match sshd. You are now only viewing the filtered lines.
    4. To exit this filter mode and see the whole file again, type & and press Enter with no pattern.

less‘s Exhaustive Command-Line Options

You can supercharge less before you even open it.

  • -N, --LINE-NUMBERS: Show line numbers. This is essential. It adds a line number gutter to the left side, just like cat -n but interactively. I recommend this almost always.Command: less -N /var/log/syslog
  • -i, --ignore-case: Case-insensitive search. If you search for /error, it will also find “ERROR” and “Error”. This flag makes it case-insensitive only if your search term is all lowercase. If you type /Error (with a capital), it will only search for “Error”. This is a “smart case” search.
  • -I, --IGNORE-CASE: Force case-insensitive search. This is always case-insensitive, even if your pattern has uppercase letters.
  • -S, --chop-long-lines: Disable line wrapping. This is the other essential flag for log files. Log lines are often very, very long. By default, less will wrap them, making them unreadable. less -S disables wrapping. Long lines will just go off the right side of the screen. You can then use the Left Arrow and Right Arrow keys to scroll horizontally.Pro-Tip: Run less -NS /var/log/syslog. This is the “God Mode” for log viewing: Line Numbers (-N) and No Wrapping (-S).
  • -F, --quit-if-one-screen: Automatically quits less if the entire file fits on one screen. This makes less behave like cat for small files, but “do the right thing” (open the pager) for large files. Some people set less as their default pager with this flag.
  • -X, --no-init: Normally, less clears the screen when you quit, returning you to your clean terminal. This flag prevents that. When you press q, the file’s contents remain on your screen, and your prompt appears below. This is useful if you want to copy-paste something after quitting.
  • -R, --raw-control-chars: If you’re viewing a file that has color codes (like the output of git log or ls --color), less will normally show the ugly control codes (e.g., [31m). less -R renders these colors correctly. Try this: ls -la --color=always /etc | less -R
  • +command: Run a command on startup. This is a power user feature. The “command” is any less keystroke you would normally use.
    • Start at the end of a file: less +G large.log (It will open scrolled to the end).
    • Start at a specific line: less +150 config.ini
    • Start and search: less +/Error system.log (It will open and immediately jump to the first instance of “Error”).

Using less with Pipes

less is the ultimate “end of the pipe” command. Any command that produces a lot of output should be piped to less.

  • ls -la /etc | less (Browse a huge directory listing)
  • ps aux | less (Browse all running processes)
  • dmesg | less (Browse kernel messages)
  • history | less (Browse your command history)

less is also the default pager for many commands. When you type man ls, you are actually inside less!

Advanced less Features (Inside the Pager)

  • F (Follow Mode): This is the less equivalent of tail -f. Press Shift+F (capital F) while viewing a file. less will go to the end of the file and “follow” it, printing new lines as they are added. This is perfect for monitoring a log file in real-time. To stop following, press Ctrl+C. You are then back in normal less mode, able to scroll and search.
  • m[letter] (Mark): Press m followed by any letter (e.g., ma). This “marks” your current position in the file with the letter ‘a’. Scroll somewhere else, and then…
  • '[letter] (Go to Mark): Press ' (single-quote) followed by the letter you used (e.g., 'a). less will jump instantly back to your marked position.
  • v (Edit): While viewing a file, press v. less will launch your system’s default text editor (defined by the $EDITOR environment variable) and open the current file at the current line. When you save and exit the editor, you will be right back in less. This is an incredible workflow for finding an error (/), and then instantly jumping to edit it (v).

less Summary

  • Strengths: The best tool for viewing files, especially large ones. Opens instantly. Powerful search, navigation, and filtering. Can be used in any pipeline.
  • Weaknesses: It is a viewer, not an editor. (Though the v key bridges that gap!)

Now that we can view anything, let’s learn how to change it.

nano – The Beginner-Friendly Editor

You’ve found the line you need to change with less. Now what? You could use a complex, powerful editor like vim or emacs, but those have a learning curve like a sheer cliff. You need to change one line, now.

Enter nano.

nano (short for “Nano’s ANOther editor”) is a simple, modeless, “what you see is what you get” text editor for the terminal. It was created as a free clone of the pico editor, which was popular for its simplicity.

nano‘s greatest feature is that it is discoverable. It tells you exactly how to use it.

nano Basic Syntax

nano [OPTIONS] [FILE]

  • nano new_script.sh (This will create new_script.sh and open it)
  • nano existing_config.ini (This will open the existing file)

The nano Interface: Your Friendly Guide

When you open nano, you’ll see your file content (or a blank screen) and, most importantly, a two-line menu at the bottom.

Nano Editor
Nano Editor

This menu is the key. The ^ symbol means the Ctrl key.

  • ^X Exit: Means Ctrl+X will exit the editor.
  • ^O WriteOut: Means Ctrl+O will save the file.
  • ^W Where Is: Means Ctrl+W will search the file.

If you see M- (which stands for “Meta”), that means the Alt key.

  • M-U Undo: Means Alt+U will undo your last action.

You don’t have to memorize anything. The most common commands are always visible.

The “Big Four” nano Commands (How to Live in nano)

You only need to know these four commands to be 100% productive in nano.

  1. ^X (Exit): This is how you quit. When you press Ctrl+X, one of two things will happen:
    • If you didn’t change the file: It just exits.
    • If you did change the file: It will prompt you at the bottom: Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? You now have three choices:
      • Press Y for “Yes” (to save).
      • Press N for “No” (to discard your changes and exit).
      • Press C for “Cancel” (to not exit, and go back to editing). If you pressed Y, it will ask for the File Name to Write:. The current name will be filled in. Just press Enter to confirm and save to that file (or type a new name to “Save As”).
  2. ^O (WriteOut / Save): This is the “Save” command (like Ctrl+S in GUI apps). It saves your file without exiting. It will prompt File Name to Write:. Just press Enter to confirm. You can now keep editing. It’s good practice to do this often.
  3. ^W (Where Is / Search): This is how you find text.
    1. Press Ctrl+W.
    2. The bottom menu changes. It will prompt Search:.
    3. Type your search term and press Enter.
    4. The cursor will jump to the first match.
    5. To find the next match, just press Alt+W (M-W in the menu).
  4. ^G (Get Help): This is nano‘s other superpower. If you forget a command, press Ctrl+G. This opens a detailed help document inside nano. You can scroll through it (using the arrow keys, just like a normal file) to find the command you need. Press Ctrl+X to exit the help screen and return to your file.

This is the beauty of nano.

  • The Arrow Keys move the cursor.
  • Page Up and Page Down work.
  • Home and End work.
  • Delete and Backspace work.
  • You just type. There is no “insert mode.” You are always in “insert mode.”

Cut, Copy, and Paste in nano

This is the only slightly tricky part, but it’s still simple.

  • To Cut a Line: Move your cursor to the line and press ^K (Cut). The entire line is cut and placed in nano‘s clipboard (the “cut buffer”).
  • To Paste a Line: Move your cursor to where you want to paste and press ^U (Uncut).

How to Cut/Copy a Selection (not the whole line):

  1. Move your cursor to the start of the text you want to select.
  2. Press Alt+A (M-A). You’ll see [Mark Set] at the bottom.
  3. Now, use your arrow keys to move the cursor. The text between the “mark” and your cursor will become highlighted.
  4. Once you’ve highlighted the text:
    • Press ^K (Cut) to cut the selected text.
    • Press Alt+6 (M-6) to copy the selected text.
  5. Move your cursor where you want to paste and press ^U (Uncut).

nano‘s Exhaustive Command-Line Options

You can customize your nano session from the start.

  • +LINE or +LINE,COL: Go to Line/Column. This is incredibly useful. nano +150 server.conf (Opens the file and jumps to line 150) nano +10,5 script.py (Opens and jumps to line 10, column 5)
  • -l, --linenumbers: Show line numbers. This is a must-have. It adds a line number gutter on the left, just like less -N. nano -l script.py
Nano Editor
Nano Editor
  • -m, --mouse: Enable mouse support. Lets you use your mouse to click to set the cursor and use the scroll wheel to scroll. Very intuitive.
  • -i, --autoindent: When you press Enter on an indented line, the new line will automatically have the same indentation. Essential for coding.
  • -w, --nowrap: Disables automatic line wrapping. Long lines will just continue off-screen, and the screen will scroll horizontally. This is much better for editing config files or code.
  • -c, --const or --constantshow: Constantly show the cursor’s position (line, column) at the bottom, instead of only on-demand.
  • -v, --view: View mode. Opens the file as read-only. You can’t accidentally break a system config file.
  • -B, --backup: When you save a file, this flag will create a backup of the original file. For example, saving config.ini will create config.ini~ containing the old version. This is a lifesaver.

Permanent Customization: The .nanorc File

All those command-line options are great, but it’s annoying to type nano -limw every time. You can make these settings permanent by creating a file in your home directory called .nanorc.

Command: nano ~/.nanorc

Now, inside this new file, you can just write the settings you want. Use set for on/off flags.

Example .nanorc file:

# My permanent nano settings
set autoindent
set linenumbers
set mouse
set nowrap
set const
set backup

# Enable syntax highlighting
include "/usr/share/nano/*.nanorc"

Save and exit (^O, Enter, ^X). Now, every time you open nano, it will automatically have line numbers, auto-indent, mouse support, no wrapping, and will make backups!

Syntax Highlighting: nano‘s Secret Weapon

That last line in the .nanorc file is the most important: include "/usr/share/nano/*.nanorc"

This tells nano to load all the default syntax highlighting definitions. nano comes with highlighting for Python, Bash, C, HTML, CSS, and dozens of other languages. When you open a file (e.g., script.py), nano will recognize the .py extension and automatically color your code.

Nano Editor Syntax Highlighting
Nano Editor Syntax Highlighting

This makes it immeasurably easier to read code, spot typos, and edit scripts.

More nano Features (From the Help Menu)

  • Alt+U (Undo) and Alt+E (Redo): These are critically important. nano has full undo/redo.
  • ^R (Read File): Prompts you for a filename. It will then insert the entire contents of that other file at your cursor’s current position.
  • ^T (To Spell): Runs a spell-checker (if one is installed on the system).
  • ^C (Cur Pos): Reports the current line, column, and character position.

nano Summary

  • Strengths: Incredibly easy to learn. No modes. Discoverable (commands are on-screen). Can be customized with .nanorc to be a surprisingly powerful and pleasant editor with syntax highlighting, line numbers, and mouse support.
  • Weaknesses: Not as powerful as vim or emacs for complex, large-scale code refactoring (but for everyday use, it’s perfect).

cat vs. less vs. nano – When to Use What

You now have three powerful tools in your arsenal. The final piece of the puzzle is knowing which one to grab for the job.

Here is your simple, scenario-based guide:

Scenario 1: “I need to see what’s in this README.md file. I’m pretty sure it’s short.”

  • Tool: cat README.md
  • Why: It’s the fastest way to just dump the content to your screen. If you’re wrong and it’s huge, you can press Ctrl+C to stop it and run less README.md instead.

Scenario 2: “I need to find a specific error in a 2GB server.log file.”

  • Tool: less -NS server.log
  • Why:NEVER use cat. less will open the file instantly, no matter the size.
    1. Use -N for line numbers.
    2. Use -S to prevent line wrapping (log lines are long).
    3. Press / and type your error message to search.
    4. Press n to find the next one.

Scenario 3: “I need to change the port number in config.ini.”

  • Tool: nano -l config.ini (or just nano config.ini if your .nanorc is set up).
  • Why: It’s an editor.
    1. nano opens the file.
    2. Press ^W (Where Is) and type port to find the line.
    3. Use the arrow keys to go to the number, delete it, and type the new one.
    4. Press ^O (WriteOut/Save), Enter to confirm the filename.
    5. Press ^X (Exit).
    • Job done in 10 seconds.

Scenario 4: “I need to combine my three report_part_X.txt files into one final_report.txt.”

  • Tool: cat report_part_1.txt report_part_2.txt report_part_3.txt > final_report.txt
  • Why: This is the job cat was born to do. It concatenates the files and the > redirects the combined output into a new file.

Scenario 5: “I want to monitor my web server’s access log in real-time.”

  • Tool: less +F /var/log/nginx/access.log
  • Why: Open less and use the +F command to start in “Follow” mode. It’s like tail -f but has all the power of less (searching, filtering) built-in. Just press Ctrl+C to stop following and start scrolling/searching.

You are no longer just staring at a terminal. You’ve graduated from a passive observer to an active participant. You have the fundamental keys to unlock, read, search, navigate, and change the files that form the bedrock of the entire Linux operating system.

What’s your favorite nano trick? Do you have a .nanorc setting you can’t live without? Did we miss a less feature you love? Leave a comment below and share your knowledge!

Buy me A Coffee!

Support The CyberSec Guru’s Mission

🔐 Fuel the cybersecurity crusade by buying me a coffee! Your contribution powers free tutorials, hands-on labs, and security resources.

Why your support matters:
  • Writeup Access: Get complete writeup access within 24 hours
  • Zero paywalls: Keep the content 100% free for learners worldwide

Perks for one-time supporters:
☕️ $5: Shoutout in Buy Me a Coffee
🛡️ $8: Fast-track Access to Live Webinars
💻 $10: Vote on future tutorial topics + exclusive AMA access

“Your coffee keeps the servers running and the knowledge flowing in our fight against cybercrime.”☕ Support My Work

Buy Me a Coffee Button

If you like this post, then please share it:

Linux 101

Discover more from The CyberSec Guru

Subscribe to get the latest posts sent to your email!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from The CyberSec Guru

Subscribe now to keep reading and get access to the full archive.

Continue reading