Breaking News

Main Menu

Terminal Touch Multiple Files

суббота 25 апреля admin 63

The command in Linux to concatenate or merge multiple files into one file is called cat. The cat command by default will concatenate and print out multiple files to the standard output. You can redirect the standard output to a file using the ‘‘ operator to save the output to disk or file system.

AbstractSome building materials, regularly used in Turkey, such as sand, cement, gas concrete (lightweight, aerated concrete), tile and brick, have been investigated in terms of mass attenuation coefficient ( ⁠ ⁠), effective atomic, numbers ( Z eff), effective electron densities ( N e) and photon interaction cross section ( σ a) at 14 different energies from 81- to 1332-keV gamma-ray energies. Mass attenuation coefficients of these samples have been compared with tabulations based upon the results of WinXcom. The gamma rays were detected by using gamma-ray spectroscopy, a High Purity Germanium (HPGe) detector. Winxcom program for calculating x-ray attenuation coefficients definition. The theoretical mass attenuation coefficients were estimated using the mixture rule and the experimental values of investigated parameters were compared with the calculated values. The elemental compositions of samples were analysed using an energy dispersive X-ray fluorescence spectrometer.

Typically you may open multiple terminals to view tail -f of multiple files as we explained in our previous.For example, if you want to view Apache errorlog and accesslog at the same time you may do the following in two different terminals.On one terminal: $ tail -f errorlogOn another terminal: $ tail -f accesslogBut, wait!Wouldn’t it be nice if you can execute multiple unix tail command in single terminal using one of the following methods? $ multi-tail.sh errorlog accesslog(or)$ tail -f /var/log/syslog -f /var/log/auth.log(or)$ multitail errorlog accesslogIn this article let us review using three methods how to execute multiple Linux tail -f at the same time in single terminal.

Method 1: Use Custom Shell Script (with Unix tail command)Create the multitail.sh as shown below. $ vi multi-tail.sh#!/bin/sh# When this exits, exit all back ground process also.trap 'kill $(jobs -p)' EXIT# iterate through the each given file names,for file in '$@'do# show tails of each in background.tail -f $file &done# wait. Until CTRL+CwaitNow, open multiple files using this new shell script as shown below.

$./multi-tail.sh errorlog accesslog Method 2: Using the standard Linux tail commandThe latest version of the Unix tail command supports multiple -f as shown below. $ tail -f /var/log/syslog -f /var/log/auth.logThe above will display file name as the first line each time, and then shows the newly grown lines. If you don’t want this to clutter the logs, you can use the next method. Use multitail command on Debian flavor of LinuxInstall multitail as shown below.

$ apt-get install multitailView multitail for multiple file $ multitail /var/log/syslog /var/log/auth.log. @Sergray,Thanks for your feedback about using grep and sed along with tail -f.@Dmitry, @Randy,I agree with you that screen is also another effecient way to view multiple log files on one terminal@Praveen,Thanks for sharing your tips. Running tail -f in the background may be OK for two files. Anything more than that, it may get little confusing.@Daniel,Thanks for catching the typo. It’s fixed now.@Emmierich,Thanks for pointing out the we can view multi files without give -f after each and every file.@Diptanu,I’m glad you found this article helpful.