What about other file types?

071

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, or tail:
    cat filename.txt
    head filename.txt
    tail filename.txt

CSV Files

  • View with cat or column:
    cat data.csv
    column -t -s, data.csv  # Formats CSV for better readability

JSON Files

  • View with cat or jq:
    cat data.json
    jq . data.json  # Pretty prints JSON data

XML Files

  • View with cat or xmllint:
    cat data.xml
    xmllint --format data.xml  # Pretty prints XML data

Binary Files

  • View with hexdump or xxd:
    hexdump -C filename.bin
    xxd filename.bin

Image Files

  • View with image viewers (not in terminal):
    You can use graphical image viewers like eog (Eye of GNOME) or feh:
    eog image.png
    feh image.jpg

PDF Files

  • View with PDF viewers:
    You can use evince, okular, or xpdf:
    evince document.pdf
    okular document.pdf

Audio/Video Files

  • Play with media players:
    Use vlc, mpv, or mplayer:
    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.

0 Comments

no data
Be the first to share your comment!