I’m using the pv utility to asses the speed of log entries being added in a log file, like this: This outputs the addition speed and refreshes every 5 sec: Now, I would like to redirect the current value (“10”) to a file and refresh it every 5s. Not append it, just overwrite the previous value in the file. Any
Tag: file
mv: cannot overwrite directory with non-directory
Is it possible to get around this problem? I have a situation where I need to move some files to 1 directory below. problem is that the filename inside g/ directory is the same as the directory name and I receive the following error: Example: /home/user/data/doc/version/3766/297534 is a directory, inside there is a also a file named 297534 so I
check if file is open with lsof
I’m using linux mint 13 xfce and I have a file named wv.gold that I’m trying to check in bash if it’s open by any program (for instance, I opened it in sublime-text and gedit) In many forums people say that if I run lsof | grep filename I should get 0 if it’s open or 256(1) if it’s closed,
Change file owner group under Linux with java.nio.Files
I have a Linux server and I’m running an image resize job in Java for multiple websites on my server. The website files are owned by different OS users/groups. Newly created thumbnails/previews are owned by the user running the resize job. Now I was googleing around how to change the file owner of newly created previews/thumbnails in my resize program
linux command to get size of files and directories present in a particular folder? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
.txt file is no longer written to by snmptrapd daemon after opening and closing with ifstream in C++
I am running Net-Snmp (environment is a virtual machine running Linux Mint OS 11) and have configured it to send trap information to a text file that I have called trapd.txt. If I reboot the VM, any trap that is generated is sent to the file no problem. However If I run a C++ program using ifstream to open it
How to clean a data file from binary junk?
I have this data file, which is supposed to be a normal ASCII file. However, it has some junk in the end of the first line. It only shows when I look at it with vi or less –> grep is also saying that it’s a binary file: Binary file data.dat matches This is causing some trouble in my parsing
Delete files with string found in file – Linux cli
I am trying to delete erroneous emails based on finding the email address in the file via Linux CLI. I can get the files with find . | xargs grep -l email@example.com But I cannot figure out how to delete them from there as the following code doesn’t work. rm -f | xargs find . | xargs grep -l email@example.com
How to sort files into folders by filetype on bash (with ‘file’ command)?
I have thousands of files without extensions after recovery (mostly pictures). I need to sort them into separate folders by filetype (folders must be created during sort process). I can determine filetype in linux using “file” command. Does somebody have bash script for it? For example: Initial dir contains files: 001, 002, 003, 004. After sorting should be 3 dirs:
how to read files with spaces and special characters in their name?
i have lots of videos in my server and i use the following code to get the duration of the video and it works fine.. But i could not get the duration for the files which has a space or any special characters like ( ‘ # % etc… I cant rename the files as it is stored already and