Use this tag for questions about file management and operations on files.

learn more… | top users | synonyms (1)

3
votes
4answers
67 views

Traverse, copy & transform file names

My issue: I need to copy log files, all with identical names, but stored 1-deep in subdirectories, and change their names. I'm copying from the a folder called Logfiles which contains a bunch of ...
4
votes
7answers
4k views

How to remove blank lines from a file in shell?

I want to remove all empty lines from a file. Even if the line contains spaces or tabs it should also be removed.
0
votes
2answers
41 views

Find command returning wrong data [duplicate]

I am using this command to list all files that have been modified in the last day (or created) find ./ -mtime 1 -ls However it keeps returning files from 30th April when I am running the command ...
1
vote
2answers
35 views

Read the file from one Unix server to the other Unix server

I have a Pro*C program which I run on Unix server a but the input file required for this program is on other Unix server b. Whenever I run I have to copy the file from server b to a. Is there any way ...
1
vote
2answers
145 views

How would I use sed or awk to extract certain lines in a file

If I wanted to search for all lines in a file that start with a date, such as "May 1", how would I do that with sed or awk? I need to extract this data and either send to screen or a file. Thanks.
-1
votes
2answers
33 views

Extracting certain data within a script output file

We have a script that runs several commands and rolls up all the output and inserts in into a log file. One of the commands it runs is "netstat -anp". I'd like to be able to search this file for all ...
6
votes
6answers
3k views

How do I grep recursively through .gz files?

I am using a script to regularly download my gmail messages that compresses the raw .eml into .gz files. The script creates a folder for each day, and then compresses every message into its own file. ...
8
votes
2answers
499 views

Finding a file type assuming wrong extension

I have an image archive I keep up. Sometimes, the sites I pull them from reformat the file while keeping the extension the same, most often making PNG images into JPG's that are still named ".png". ...
23
votes
3answers
39k views

Find and remove large files that are open but have been deleted

How does one find large files that have been deleted but are still open in an application? How can one remove such a file, even though a process has it open? The situation is that we are running a ...
2
votes
2answers
77 views

List files recursively in Linux CLI with path relative to the current directory, max 250 char

I'm trying to list all the files with names no longer than 250 characters (including the directory it is part of, from the relative path my command is inside). I've seen a similar thread , but that ...
11
votes
4answers
1k views

Can a file that was originally sparse and expanded be made re-sparse

I know that copying or transferring what was originally a sparse file without using a utility that understands sparse files will cause the 'holes' to be filled out. Is there a method or utility to ...
5
votes
2answers
2k views

Fast elimination of duplicate lines across multiple files

I have a huge amount of data in which each (data-)line should be unique. There are a lot of files in one folder in which this is already true. It is about 15GB splitted into roughly 170 files with ...
0
votes
0answers
28 views

Regex for a non-fixed pattern

I am trying to come up with the right regex (compatible with python) that would match a file that contained sample input as follows: On the third day of Christmas my true love sent to me: three ...
3
votes
2answers
14k views

NFS permission denied

When I configure NFS and create a file on the client NFS shared dir, I get the following message: permission denied. My configuration: configuration nfs server ...
5
votes
2answers
198 views

What are .serverauth.##### files in my home directory?

The files are .serverauth.##### where ##### is a 5-digit number. I have a handful of these files in my home directory with a broad range of creation dates spanning a couple of years. What are these ...
7
votes
2answers
1k views

How to make a temporary file in RAM?

I have a script that will pipe its output to |tee scriptnameYYMMDD.txt. After each cycle of the for loop in which the output is generated, I'll be reversing the file contents with tac ...
2
votes
4answers
4k views

Count files in a directory by extension

For the purpose of testing, I'd like count how many images files are inside a directory, separating each image file type by file extension (jpg="yes". This because later it will be useful for another ...
0
votes
1answer
20 views

Incrontab / Incron on Cygwin

Does anyone please know if it is possible to install incron/incrontab within Cygwin? I've had a look and the package does not appear on the cygwin website, I wondered if anyone had tried, knew of any ...
1
vote
2answers
110 views

Why is there a file called [ in my /usr/bin directory? [duplicate]

Recently back to Linux from another operating system I noticed a file called [ which seems strange to me. What is it for? $ ls -l /usr/bin | head -2 -rwxr-xr-x 1 root root 39552 Nov 3 14:44 [ ...
0
votes
1answer
26 views

How to fix ntfs file problem when there is now windows?

I have a "stubborn" file on an NTFS partition which refuses to be deleted. A little background on the problem... Problem happened when I was running Zim on my Linux and the system froze due to some ...
1
vote
2answers
46 views

How do I get a count of file references inside a folder of files with those references?

Alright, I have two folders. For simplicity's sake, I'll call them people and animals. The animals folder has a file for each animal, and the people folder has a file for each person with references ...
1
vote
1answer
72 views

What is this file: .readahead doing in my root directory?

When I do: ls -a / on Fedora 21 there is a hidden file named: .readahead and it's 104092k What is this file?.... is it suppose to be there? I found this on google: readahead system call on ...
1
vote
1answer
363 views

Apache created files and its permissions for CentOS 6.x

In short, I have an authenticated HTTP-POST that: posts a jpg image (created as 666 apache:www) into /directory1 (777 ftpuser:www) creates /directory2 (created as 666 apache:www) in a 777 ...
2
votes
1answer
44 views

Using wget, how to download to a specific location, without creating folders, and always overwrite original files

How do I use wget to download files to a specific location, without creating directories, and overwrite the original every time. I've tried using the -r -P and nc options in combination but this ...
0
votes
1answer
47 views

command “find … -exec mv …” created a file with strange content

I wanted to move binary files from folder /myhome/sourcedir to /myhome/targetdir. I used a command find /myhome/sourcedir -type f -cmin +3 -exec mv '{}' /myhome/targetdir ';' Folder /myhome/sourcedir ...
8
votes
1answer
238 views

What three files are always opened by a process?

Someone mentioned that there are three different files that a process always opens. What does this mean? What files are they?
1
vote
1answer
18 views

Map Home to External Drive

Whereas I have my OS (in this case, Elementary OS Freya) installed on my non-partitioned internal hard drive, I have an external hard drive with /Documents, /Downloads, /Movies etc. where I store all ...
3
votes
2answers
66 views

List direct symbolic links (links that don't point to another symlink)

I need to make a list of all direct symbolic links in a directory, i.e. symbolic links that point to another file which is not a symbolic link. I tried to do it this way: for i in $(ls -1A); do ...
0
votes
1answer
31 views

Understanding syslog rotation, to implement own syslog rotation

I am trying to implement a simple syslog server (UDP based). On this , we are trying to implment SYSLOG rotation feature. Currently the roatation of logs is done by rename C API. By doing this we ...
0
votes
1answer
42 views

How do I copy all files that have been created or modified in the last 12 months?

I would like to copy all the files created in the last 12 months to a new folder leaving behind everything else. Including sub folders.
0
votes
1answer
73 views

What is the file type “raw G3 data, byte-padded”

I ran $ find ~/ |xargs file|grep -i -e SQLite just to understand what programs use sqlite. I started seeing lines like /home/alord/hg/cpython/.hg/store/data/_modules/__sqlite/cursor.c.i: raw G3 ...
25
votes
5answers
53k views

How to list all files in the size order

I would like to list all files in the order of big to small in size and the files could be present anywhere in a certain folder.
4
votes
4answers
984 views

Using GNU Parallel With Split

I'm loading a pretty gigantic file to a postgresql database. To do this I first use split in the file to get smaller files (30Gb each) and then I load each smaller file to the database using GNU ...
14
votes
5answers
1k views

How is a directory a “special type of file”?

I am reading this Unix tutorial and came across this quote... We should note here that a directory is merely a special type of file. ...but no explanation or details are provided. How is a ...
1
vote
1answer
80 views

ext4 disk space not reclaimed after deleting files

I recently got a "device full" warning for a 2 Tb external ext4 drive. I deleted a bunch of files, about 90-100 Gb of old system backups, and since I did not want to empty all trash, I deleted the ...
1
vote
2answers
23 views

How to check if a group of files is readable?

I have to check if a group of files is readable. I know how I would go about checking one file by using [ -r file.txt ], but how would I go about writing a loop that would check multiple files ...
1
vote
1answer
65 views

Sticky bit and users with sudo permission

Let's say I chmod 1777 a folder /opt/test and all files inside it as user user1. Hence user2 is able to update and edit files inside the /opt/test directory. When user2 operates via sudo, he's able ...
-3
votes
3answers
77 views

Delete line from files

I have 8 files in a folder. If any of these files has 2 lines I need to remove the second line from that file. If a file has more than 2 lines then then I do not need to do anything to it. Can anyone ...
7
votes
2answers
333 views

How to store a large folder in a single file without compression

Sorry if this is a stupid question, but I want to take a 78gb folder and store it in a single file (for upload into a cloud service), as if I am compressing it in an archive, but I don't want any ...
54
votes
5answers
39k views

What is a Superblock, Inode, Dentry and a File?

From the article Anatomy of Linux File Systems by Tim Jones, I read that Linux views all the file systems from the perspective of a common set of objects and these objects are superblock, inode, ...
0
votes
2answers
427 views

How to move completed torrent downloads to another folder without breaking the torrent link?

I'm using Transmission on EOs and I've downloaded a bunch of torrent files which ended up my Download folder in my /home. I'd like now to move the files to my external hard drive without breaking the ...
3
votes
3answers
122 views

Remove passphrase from private key and set specific file mode

If I set a passphrase on my private key like so: openssl rsa -des -in insecure.key -out secure.key and I remove the passphrase like so: openssl rsa -in secure.key -out insecure.key then my ...
1
vote
1answer
18 views

File with a no-atime-updates “A” attribute still updates atime. Why?

$ stat file_1 | tail -n 4 Access: 2015-04-16 21:48:42.675095130 +0200 Modify: 2015-04-16 21:48:42.675095130 +0200 Change: 2015-04-16 21:51:31.844300132 +0200 Birth: - $ lsattr ...
4
votes
1answer
48 views

Find the files between two folder dates in linux?

I need to find the folder names along with the file names which has my string in their contents. I am in this directory "/data/queue/data" and I have lot of folders in the same directory and inside ...
19
votes
4answers
24k views

How can I find out how many lines a text file contains without viewing it?

How can I find how many lines a text file contains without opening the file in an editor or a viewer application? Is there a handy Unix console command to see the number?
2
votes
1answer
56 views

How to split file and save parts to multiple locations?

How do I split a large file into multiple smaller chunks and write each part of it into separate locations? split command seems to only output all the files into one location. The context I need to ...
-1
votes
1answer
48 views

How to remove duplicate lines from file? [duplicate]

I have file for example 'a' aaa aaa bbb ccc ccc bbb ddd After executing uniq a c i get file 'c' aaa bbb ccc bbb ddd How to delete duplicate bbb lines?
3
votes
4answers
523 views

Is is possible to modify a file in a read only directory? [duplicate]

I have already read: Is there a way to modify a file in-place? I am curious if there is a way to modify a file in place using a command that will not create temporary files. Let's say I create a ...
1
vote
1answer
27 views

File corruption using rsync, multiple rsync processes, moved/renamed source file

I'm encountering some file corruption when using rsync (that is, the file contents do not match the source file). I can understand the file becoming corrupt if it is being written to while being ...
3
votes
4answers
3k views

Wait for multiple files to be finished downloading

I have the following script which checks if there is a file in a folder and if the file is stable (this is for large video file I am receiving). #!/bin/bash cdate1=$(date +%Y%m%d-%T) ...