cat -n file.txt
You have a source code whose content you want to display on the stdout. The natural way to do that is the “
cat” command but it’s monochrome. How to get a syntax-highlighted output?
Use pygments. If you install it (“
sudo apt-get install python-pygments“), you will have a command called “
pygmentize” that you can invoke from the command line.
pygmentize -f terminal256 -O style=native -g color_me.py
Tip: put an alias on it.
alias pcat="pygmentize -f terminal256 -O style=native -g"
There are different styles available, see “
pygmentize -L” for a list.
- Using Pygments with less (thanks rajbot)
Jabba the Cat #1
But where is Princess Leia?!
Jabba the Cat #2
You have a large file and you want to split it up in several pieces of the same size.
Let’s say we want pieces of
50,000,000 bytes (50 MB approximately).
split --bytes=50000000 film.avi
By default, the output files are named as ‘
xac‘, etc., where ‘
x‘ is the prefix and ‘
ac‘, etc. are the suffixes.
Use the command
cat to put them together:
cat xaa xab xac >out.avi
cat x* >out.avi
split --bytes=50000000 -d film.avi pre-
Now the pieces will be named as
pre-02, etc. The switch
-d means to use numeric suffixes.
split --bytes=50m -d film.avi pre-
Now the size of the output pieces is really 50 MB, i.e.