alias
|
||
---|---|---|
Redefine a command. | ||
alias rm="rm -i" asks for confirmation when deleting a file.
|
||
Include as a line in .bashrc
|
Assembler | ||
---|---|---|
The compiler gcc with the option -S converts a C code into assembler. Its object code is got with as -o and it can be transformed into executable code with gcc .
|
||
|
||
See GNU Assembler for a Hello, world! example. |
cal
|
||
---|---|---|
Make a calendar. | ||
|
||
chmod
|
||
---|---|---|
Set permissions. | ||
|
||
Compress, pack, extract and unpack (gzip , bzip2 , tar , zip )
|
||
---|---|---|
|
||
convert
|
||
---|---|---|
This is a powerful tool depending on ImageMagick with a lot of options. | ||
|
||
See also mogrify . In the website of ImageMagick there are many examples.
|
cp for massive copy
|
||
---|---|---|
|
||
crontab
|
||
---|---|---|
A cron is a file containing commmands to be executed with a certain periodicity. The format of each line of the file is
(taken from wikipedia):.---------------- minute (0 - 59)For scripts it is important to write the complete path and do not use relative paths. |
||
One example of a cron with one line is:
|
||
du
|
||
---|---|---|
Size of directory trees and files. | ||
|
||
ffmpeg to capture the desktop
|
||
---|---|---|
See the examples. | ||
|
||
It is convenient to put the launching konsole out of the captured region. Another possibility is to specify the time and launch the command with Alt+F2. The documentation includes many examples. See also this. |
ffmpeg to change the audio or video format
|
||
---|---|---|
Essentially it is enough to precede the input file with -i .
|
||
|
||
The documentation includes many examples. See also this. |
ffmpeg to create a video from images
|
||
---|---|---|
See the example. | ||
|
||
It seems better to adjust the quality with the option -crf in the library libx264 using a shell script like this:#!/bin/bash Depending on the choice of qual , the size in megas of output.avi for a clip of one minute (1440 images at 24fps) was
18 -> 5.4, 20 -> 4.3, 22 -> 3.4, 24 -> 2.8, 26 -> 2.4,
2.8 -> 2.1.The documentation includes many examples. See also this. * |
ffmpeg to extract audio
|
||
---|---|---|
See the example. | ||
|
||
The documentation includes many examples. See also this. |
fold
|
||
---|---|---|
Adjust the number of characters per line of a text file. | ||
fold -s -w80 mysource.txt > mydestination.txt copies mysource.txt into mydestination.txt adjusting the number of columns to 80.
|
||
The option -s indicates to break at spaces. This is of course impossible if the length of a word is longer than the length of the line.
|
Gimp: Save-all-layers
|
||
---|---|---|
There is a script sg-save-all-layers.scm by Saul Goode to save all layers as different image files.
It must be downloaded in .gimp-2.8/scripts . Running gipm in the menu File it will appear the new option. The symbols ~ indicate the digits to numerate the image files storing the layers.
|
||
If gimp was already running, perhaps it is necessary to refresh the scripts in Filters>Script-Fu>Refresh scripts .
|
iconv
|
||
---|---|---|
See the example. | ||
|
||
Information about the system | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
The files /proc/cpuinfo and /proc/meminfo that can be seen with cat , contain more detailed information about the CPU and the memory.
|
KDE Plasma keyboard shortcuts | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||
Taken mainly from the
KDE documentation. Important: In non American keyboards some combinations involving the special key (the windows key in PCs) can be very difficult to revert, for instance zoom. To recover temporarily the panel use Shift+Alt+F12 . In the case of zoom, edit .config/kwinrc setting [Effect-Zoom]
InitialZoom=1 .
|
kill
|
||
---|---|---|
One of the strongest commands to kill a process is kill -9 followed by the number of the process that can be checked with ps -A . Another possibility to kill all the instances is using killall or pkill followed by the name.
A graphic variant of kill is xkill , the left button is to kill and the right one to cancel.
|
||
If after running |
||
ls by date
|
||
---|---|---|
The option -t sorts the output by last modified date. It is more convenient to use it in combination with -a" and |
||
|
||
mencoder
|
||
---|---|---|
It is an alternative to ffmpeg to convert video files that in fact uses it.
|
||
The output files are usually very heavy. To suggest an approximate size it can be used a double pass encoding of the following kind:
Here |
||
There is information here
here.
A possibility is using mencoder with the firefox add-on
video-downloadhelper.
|
mogrify
|
||
---|---|---|
It is very similar to convert . The image is overwritten with format and it allows to massive changes of the format.
|
||
|
||
mv multiple files
|
||
---|---|---|
The only efficient ways to do it is using shell scripts. | ||
To change all the extensions
To move
To move |
||
nslookup and dig
|
||
---|---|---|
The command nslookup followed of an IP number gives the name and vice-versa. With dig the IP number must be preceded by -x
|
||
The output of |
||
PDF to lighter PDF | ||
---|---|---|
Sometimes after scanning a document the resulting PDF is too heavy. It is possible to reduce the size with gs as in the example
|
||
|
||
In the last example the possibilities for -dPDFSETTINGS from lower to upper quality are /screen , /ebook , /printer and /prepress .
|
PDF to PS | ||
---|---|---|
In principle this is as easy as printing the PDF in a PS file or using the command pdf2ps but sometimes I have had problems with the result. An alternative is pdftops that has worked to me but sometimes messing the margins. In this case a previous treatment with pdfcrop solved the problem.
|
||
|
||
pdfcrop
|
||
---|---|---|
As the name suggests crop or adjust the margins of a PDF file. The margins are specified the option --margins .
|
||
|
||
pdftk
|
||
---|---|---|
This application is a toolkit to manipulate PDF files. | ||
convert xc:none -page A4 blank.pdf creates the blank page file blank.pdf .
The following script extracts the first and last page of the PDFs in a folder and put each couple in a PDF in the folder
#!/bin/bash
|
||
The documentation and examples are here. An alternative to merge files is gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=total.pdf file1.pdf file2.pdf file3.pdf
See also this. |
pdftotext
|
||
---|---|---|
It converts a PDF file into a text file. For languages different from English it might be necessary to specify the encoding. To get a list of all possibilities run pdftotext -listenc . The option -layout respects the format of the pages.
|
||
|
||
Expanding the last example, once I used pdftotext in combination with pdftk to decide if a fairly long PDF file, input.pdf , had less than 3000 characters per page and I used the following schell script:
|
ps2pdf
|
||
---|---|---|
It converts PS to PDF. The option -sPAPERSIZE allows to specify the size avoiding to lose the format.
|
||
|
||
psbook
|
||
---|---|---|
Reorder the pages of a PS file to put them in the right order to make booklets. | ||
Once I found useful |
||
pstops
|
||
---|---|---|
The man description says that "rearranges pages from a PostScript document" but it has more possibilities.
|
||
I used
|
||
See also the examples in man pstops . A less powerful alternative way of grouping pages in blocks of n is psnup -n . For instance psnup -4 input.ps output.ps but in my experience it gives some problems with the margins.
|
recode
|
||
---|---|---|
See the examples. | ||
|
||
See iconv .
|
script
|
||
---|---|---|
It stores everything displayed on the terminal. Use exit to finish.
|
||
|
||
tee
|
||
---|---|---|
It writes the standard output in a file. | ||
|
||
vi (mini cheatsheet)
|
||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
There are two modes, the command mode and the input mode. From the latter one changes to the former with ESC and typing : one can use the special commands. The most important commands are:
In command mode h, j, k and l behave as the arrows if they do not work. Some commands are:
To change to input mode the basic commands are:
|
||||||||||||||||||||||||||||||||
YaST: global codification UTF-8 | ||
---|---|---|
In opensuse, to avoid a global codification with UTF-8, in YaST find System>Languages and click on Details in Primary Language Settings then uncheck Use UTF-8 Encoding . It is convenient to restart the system. The preferences of each editor must be adjusted to the chosen default codification.
|
||