Common usage tools in linux

The main goal of this note is to record the common usage of the tools. However, some tools might not be that frequently use but when you need that, it is a kind of fast searching in this note. I will try to record as complete as possible for.

Software

Lightweight markup language - Markdown

This is one of the famous language that can be used to write the documents with only few kinds of easy notation. The application of this language like the readme file on Github, or Blog articles.

There are several tools that can edit with the markdown language. In gnome environment, the default text editor, gedit, is good enough to write the text. However, Typora is another options that it immediately shows the render results without open a new window. On the other hand, the famous editor, Atom, is also a good platform to write the markdown file.

Mark text This is better than the Typora. The interface is mixed with the Typora that you can directly view the result immediately and also show the observation


Commandline program

tree

This is for printing the documents structure, which can be used for the reconstrction data in a better arrangments.

Common usage commands
tree -dvon outputfile.txt

The meaning of parameter:

​ d List directories only
​ v Sort files alphanumerically by version.
​ o Output to file instead of stdout.
​ n Turn colorization off always

mkvmerge

Basically just for merging the files. It can additionally add the subtitle to the video.

ffmpeg

For converting, merging, and compressing the video directly. With the help from the bash script, the converting of the files could be automatically completed. [^1]

Some frequently used parameters:

Example bash script:

  • Auto execration script

    1
    2
    3
    4
    5
    6
    #!bin/bash
    #-c:v libx264 -b:v 1500k video x.264, 1500k bitrate
    #2 pass encode
    for name in *.MTS; do
    ffmpeg -y -i "$name" -c:v libx264 -deinterlace -crf 27 -preset slower -q:a 2 -af "volume=5dB" "${name%.*}.mp4"
    done

#https://unix.stackexchange.com/questions/183308/help-with-script-over-a-list-of-files
LIST=''
for i in *.mp4; do
if [ -n "$LIST" ]; then LIST="$LIST +"; fi
LIST="$LIST$i"
done

mkvmerge -o newfile.mp4 $LIST

1
2
3
4
5
6
7
8
9
10
- Two pass filtered Example
```bash
#!bin/bash
#-c:v libx264 -b:v 1500k video x.264, 1500k bitrate
#2 pass encode
for name in *.MTS; do
ffmpeg -y -i "$name" -c:v libx264 -b:v 1500k -deinterlace -preset slower -pass 1 -f mp4 /dev/null
ffmpeg -y -i "$name" -c:v libx264 -b:v 1500k -deinterlace -preset slower -pass 2 -q:a 2 -af "volume=5dB" "${name%.*}.mp4"

done

Storage operation

Format the USB driver [^2]

  1. Find the location of the target disk

    $ lsblk

  2. umount it (If located as sdd1)

    $ umount /dev/sdd1

Restore liveUSB as USB disk

  1. Find the location of the disk

  2. Format the USB drive

    sudo mkfs.vfat /dev/sdc1

  3. Delete all the partition and recreate it

1
2
3
4
5
6
7
8
9
10
11
12
13
$ sudo fdisk /dev/sdx
Type d # to proceed to delete a partition
Type 1 # to select the 1st partition and press enter
Type d # to proceed to delete another partition (fdisk should automatically select the second partition)

Type n # to make a new partition
Type p # to make this partition primary and press enter
Type 1 # to make this the first partition and then press enter

Press enter to accept the default first cylinder
Press enter again to accept the default last cylinder

Type w # to write the new partition information to the USB key

[^1]: FFmpeg introduction (Chinese). FFmpeg official Website For the normalization sound of the files.

[^2]: Linux formate USB as NTFS (Chinese)