Use cat to dump a whole small file to your terminal, less to page through a large one without flooding your screen, and head or tail to peek at just the beginning or end. All four ship on every Linux system, including the SSH shell on Flashcloud hosting, and none of them modify the file, they only display it.
Which one you reach for depends on the file's size and what you're looking for. Config files and small scripts: cat. Log files, big exports, anything you're not sure the size of: less. Checking the last few lines of a log after an error: tail.
cat: dump the whole file
cat stands for "concatenate." It prints a file's full contents to the terminal in one go:
cat public_html/wp-config.php
Fine for anything short: a .htaccess file, a small PHP script, a config file. On a file with thousands of lines, everything scrolls past and only the tail end stays on screen, so cat stops being useful past a certain size. You can also use it to combine files:
cat file1.txt file2.txt > combined.txt
less: page through a large file
less opens a file in a scrollable viewer instead of dumping it all at once:
less error_log
Inside less:
SpaceorPage Down- next pageb- previous page/searchtermthenEnter- search forward,nto jump to the next matchG- jump to the end of the fileg- jump back to the startq- quit
less doesn't load the whole file into memory up front, so it stays responsive even on very large logs. It's the right default whenever you're not sure how big a file is. If you've ever used more, less is a strict improvement: it scrolls both directions and supports search.
head and tail: just the ends
head prints the first lines of a file, tail prints the last. Both default to 10 lines:
head access_log tail error_log
Use -n to change the count:
tail -n 50 error_log
tail is the one you'll reach for most on a live server, because the newest entries in a log file are appended to the end. When you're chasing down a PHP error right after it happened, tail -n 50 error_log gets you straight to the relevant lines without paging through the whole file.
The really useful form is tail -f, which follows a file as it grows and prints new lines as they're written:
tail -f error_log
Leave that running while you reproduce a bug on the site, and you'll watch the error land in real time. Press Ctrl+C to stop following.
Where these apply on Flashcloud hosting
You'll use these commands most often on log files and config files inside your hosting account: error_log in your site's root or a subdirectory, access_log, and files like .htaccess or wp-config.php under public_html. Connect over SSH (see FTP and SFTP accounts for the equivalent file-transfer setup if you need to pull a copy locally instead) and these four commands cover most of what you'd otherwise open File Manager for, once you're comfortable with a terminal.
If a command that worked fine before suddenly returns "Permission denied," it usually means the file belongs to a different user or process. Check Checking your hosting resource usage if you're trying to track down what's filling up disk space, since large log files are a common culprit and less plus tail are exactly the tools for inspecting them before you delete anything.