In Linux, you can view various types of files using different commands, depending on the file format. Here are some common file types and how to view them:
Text Files
- View with
cat,head, ortail:cat filename.txt head filename.txt tail filename.txt
CSV Files
- View with
catorcolumn:cat data.csv column -t -s, data.csv # Formats CSV for better readability
JSON Files
- View with
catorjq:cat data.json jq . data.json # Pretty prints JSON data
XML Files
- View with
catorxmllint:cat data.xml xmllint --format data.xml # Pretty prints XML data
Binary Files
- View with
hexdumporxxd:hexdump -C filename.bin xxd filename.bin
Image Files
- View with image viewers (not in terminal):
You can use graphical image viewers likeeog(Eye of GNOME) orfeh:eog image.png feh image.jpg
PDF Files
- View with PDF viewers:
You can useevince,okular, orxpdf:evince document.pdf okular document.pdf
Audio/Video Files
- Play with media players:
Usevlc,mpv, ormplayer:vlc audio.mp3 mpv video.mp4
These commands and tools allow you to view and interact with various file types in a Linux environment effectively.
