Skip to content


Die Spülung nur bei geschlossenem Deckel benutzen

Bitte die Spülung nur bei geschlossenem Deckel benutzen

So gesehen unlängst in einem der neuen ÖBB Züge. Ich musste feststellen, dass sich alle Benutzer der Toillette brav an dieses Schild gehalten haben.

Immerhin war der Deckel ja offen…

 

Posted in Impressionen, Reiseberichte.

Tagged with .


Extract file in different folder

Usually tar extracts files in the current directory. To change that, use the -C flag
tar xzf [pathtofile .tar.gz] -C [pathtoextractlocation]

Posted in ITechnische Post.

Tagged with , , , , .


Rename files

If you want to rename multiple files in Linux, you could use rename.
Syntax
rename 's/oldpattern/newpattern/' *

Replace oldpattern with the string you want to replace and newpattern with the string to replace oldpattern.

Posted in ITechnische Post.

Tagged with , , .


Linux: Copy a file to multiple directories

The Linux command cp does support multiple source files, but not multiple targets. Therefore one needs to use a workaround, such as

ls| xargs -n 1 cp file.dat

The command copies file.dat to all folders returned by ls.

Posted in ITechnische Post.

Tagged with , , , .


Gnuplot display maximum values

Gnuplot is a nice plotting tool. Unfortunately, not all options are easy to find.
If you want to identify the maximum value within a plot, do the following:

1) Plot the data you are interested in.

2) Afterwards,

to get the maximum value of the x value (in the data set, not in the plotted area) type

print GPVAL_DATA_X_MAX

for the y axis, type

print GPVAL_DATA_Y_MAX

for the color bar type

print GPVAL_DATA_CB_MAX

Posted in ITechnische Post.

Tagged with , .


Linux: delete a list of files

In order to delete a list of files, specified in a file, do the following.
Open a terminal and type

xargs rm < filesToDelete.txt

Posted in ITechnische Post.

Tagged with , , , .


Linux, tar a list of files

In Linux, using the terminal, compressing files is easy. Just type

tar -czf archive.tar.gz /what/to/compress

How to compress certain files of a folder?

  • Create a list of the files to compress.

e.g. create a list of all *.txt files in a directory:  ls *.txt > filelist.txt

  • Use the following command to compress the files in the list

tar -czf output.tar.gz --files-from test.out

 

Posted in ITechnische Post.

Tagged with , , , , , .


Linux, terminal redirect output

Linux uses two different kinds of output. STDOUT and STDERR. As the name suggests, normal output usually is written to stdout, while errors are sent to stderr. However, it is the responsibility of the program(e.g. the programmer) to do so, therefore it can be that error messages are also sent to stdout.

When using the terminal, both stdout and stderr are by default shown. stdout is associated with 1, stderr with 2. For the sake of completeness, the number 0 stands for stdin, a way of inputting data.

To redirect the normal output (stdin) to a file use:

myprogram 1> /path/to/some/file

In this case, the output file is always replaced. To append to an already existing file use

myprogram 1>> /path/to/some/file

To redirect stderr to a file use:
myprogram 2> /path/to/some/file

In this case, the output file is always replaced. To append to an already existing file use

myprogram 2>> /path/to/some/file

To redirect both stdout and stderr to the same file, use:

myprogram > /path/to/some/file 2>&1

In this case, the output file is always replaced. To append to an already existing file use

myprogram >> /path/to/some/file 2>&1



Posted in ITechnische Post.

Tagged with , , .


Linux, force immediate reboot from terminal

The standard

shutdown -r now

or

reboot

Usually work fine from the terminal. However in some cases a more brute force approach is necessary. The following command is the equivalent to pressing the reset button.

WARNING: Use at your own risk. This command does not shut down the machine carefully, it will reset the machine!!!

echo b > /proc/sysrq-trigger

Posted in ITechnische Post.

Tagged with , , , , .


Linux terminal, order by size

To order the file list given by ls by their respective file sizes, use:
ls -ls | sort -n

Posted in ITechnische Post.

Tagged with , , , , , .