In Linux, files can be viewed and inspected using various command-line tools. cat, head, tail, less, and file are commonly used for displaying file contents and determining file types.
less: View file contents interactively (scrollable).
less file.txt: Open a file for reading.
head/tail: View the start or end of a file.
head -n 10 file.txt: Show first 10 lines.
tail -f file.log: Monitor a log file in real-time.
file: Determine a file’s type.
file filename: Identify file format (e.g., text, binary).
Top comments (0)