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

learn more… | top users | synonyms (1)

4
votes
4answers
2k views

Simple, user-friendly GUI file finder?

simple, user-friendly = as Google search web page, one editbox, one button, nothing to explain, everybody grasps an idea in 1ms fast = finding files and directories by filenames, not by content (!) ...
1
vote
0answers
248 views

How can I make scripts run when a file/directory changes in Linux (like Mac OS X’s launchd)? [duplicate]

Possible Duplicate: Can a bash script be hooked to a file? On Mac OS X, there’s a handy daemon called launchd which (amongst other things) allows you to have scripts run when files or ...
1
vote
2answers
2k views

Creating an empty file having a variable name in a script

I need to create an empty file using a shell script. The filename will be determined by examining all the files in a directory matching a pattern, say TEST.*, and appending _END to it so that the new ...
4
votes
3answers
1k views

How many bits is the access flags of a file?

How many bits on a linux file system is taken up for the permissions of a file?
6
votes
2answers
782 views

Change file creation time on a FAT filesystem

I need a way to change the creation time of a file on a mounted FAT32 volume. I have to do that because my MP3 player will only read files sorted by this creation time. If I can find a way to set the ...
10
votes
4answers
13k views

How to list files sorted by modification date recursively (no stat command available!)

How can I get the list of all files under current directory along with their modification date and sorted by that date? Now I know how to achieve that with find, stat and sort, but for some weird ...
14
votes
4answers
11k views

last time file opened

Is it possible to get the time when file was opened last time and sort all files in a directory by those times?
7
votes
2answers
1k views

How can I cut a large file in place?

I have a very big text file, about 80GB, and I need to cut a part form it that lies between two given lines. The part I need is not big, and I have not enough space left on the hard drive to do things ...
2
votes
1answer
885 views

How can I add a line to multiple files in a directory tree structure?

Adding a line to multiple files in the same structure is not very hard, but I am stumped on how to do it over a possibly large directory tree structure. So lets say we have your project directory, ...
4
votes
2answers
705 views

rm -rf failing if deleting in parallel

rm -rf will fail if something tries to delete the same file tree (I think because rm enumerates the files first, then deletes). A simple test: # Terminal 1 for i in `seq 1 1000`; do mkdir -p ...
14
votes
2answers
3k views

How do open files behave on linux systems?

I just renamed a log file to "foo.log.old", and assumed that the application will start writing a new logfile at "foo.log". I was surprised to discover that it tracked the logfile to its new name, and ...
0
votes
1answer
973 views

How to copy files nested in directories that match a pattern?

I'm looking to copy files from subdirectories that match this pattern vendor/plugin/*/tasks/*.rake into a folder lib/tasks I think that this could be done several ways, but wanted to see if a ...
4
votes
2answers
469 views

Find incoming symlinks

In Linux, what is the best way to find all symbolic links that point to a given file (regardless of whether the symlink is relative or absolute)? I realize this will require scanning the whole ...
7
votes
4answers
5k views

Number of files containing a given string

How can I count the number of files (in a directory) containing a given string as input in bash/sh?
10
votes
4answers
7k views

Use of O_DIRECT on Linux

If this question is too programmer oriented, let me know. I wonder if there are people familiar with the O_DIRECT flag for the open() system call on Linux 2.6? Linus disparages its use, however high ...
13
votes
4answers
3k views

Is it possible to find out what program or script created a given file?

Three files have suddenly appeared in my home directory, called "client_state.xml", "lockfile", and "time_stats_log". The last two are empty. I'm wondering how they got there. It's not the first time ...
9
votes
3answers
2k views

Can I make `cut` change a file in place?

The man page doesn't give me much hope, but I'm hoping it's an undocumented (and/or GNU-specific) feature.
27
votes
3answers
2k views

Can a bash script be hooked to a file?

I want a script to sleep unless a certain file is modifed/deleted (or a file created in a certain directory, or ...). Can this be achieved in some elegant way? The simplest thing that comes to my mind ...
14
votes
2answers
2k views

How can I count the number of different characters in a file?

I would need a program, that outputs the number of the different characters in a file. Example: > stats testfile ' ': 207 'e': 186 'n': 102 Exists any tool, that do this?
3
votes
1answer
386 views

How to recover a missing file

I am running ubuntu and last week the system didn't let me alter files as if I had no write permissions. Then on reboot the system did a check of the system which took some time. Then everything went ...
39
votes
5answers
28k 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, ...
7
votes
3answers
452 views

Why do tar and gzip files usually have a file extension?

File extensions are not necessary on unices, still every tarred, gzipped or bzipped file I encounter has a file extension like .tar, .tar.gz or .tgz. Is there any special reason for that or is that ...
18
votes
3answers
27k views

How to merge all (text) files in a directory into one?

I've got 14 files all being parts of one text. I'd like to merge them into one. How to do that?
16
votes
1answer
10k views

What does dead.letter files do

I find dead.letter files from time to time in my $HOME directory. What they are for?
2
votes
1answer
192 views

Prevent libflashplayer.so from deleting a file?

I'm trying the preview release of Flash Player "Square" for Linux and noticed that video files are now being deleted from the /tmp/ folder. Yet the files are still in use (I can see them with lsof): ...
49
votes
15answers
13k views

Is there an easy way to replace duplicate files with hardlinks?

I'm looking for an easy way (a command or series of commands, probably involving find) to find duplicate files in two directories, and replace the files in one directory with hardlinks of the files in ...
2
votes
3answers
199 views

archive files and directories before transfer

I was wondering what is the advantage of making all the files and directories into an archive file for transfer, such as by cpio, instead of transferring them directly, such as by cp, scp?
25
votes
2answers
24k views

timestamp, modification time, and created time of a file

I just know that ls -t and ls -f give different sorting of files and subdirectories under a directory. What are the differences between timestamp, modification time, and created time of a file? How ...
9
votes
5answers
2k views

How to create a file even root user can't delete it

How to create a file even root user can't delete it ?
3
votes
1answer
3k views

Error when using stat, errno=2

The case is as this, I create many files, and after the file generation, I use stat to get the all files info under the directory. The purpose is to purge all the files which are old than the ...
4
votes
2answers
2k views

Remove a corrupted file in a Linux system

How to remove a file that is corrupted? In Linux (Fedora based), when I type: ls -l I get drwxr-xr-x. 2 dmiller3 dmiller3 4096 Jul 26 13:57 SomeFile ?????????? ? ? ? 4096 ...
13
votes
3answers
14k views

How to find binary executables within a directory

How do I list all binary executable files recursively within a directory? I use find command like this: find /mydir/mysubdir -executable -type f All executable files are listed (excluding ...
8
votes
6answers
235 views

Grab certain contents of a file

So I know tools exist for this problem because I've heard about them, but I don't know what they are. I want to do something like filter out all data but the usernames in /etc/passwd. For example, I ...
14
votes
3answers
2k views

I accidentally chmod -R +x on a directory. How do I restore the correct permissions?

Well, to be specific, it was chmod -R 755. Now every file is executable, which I don't want. I am thinking that I should look at the first two bytes of each file for the #!, but will this cover ...
2
votes
1answer
1k views

How to zip individual files from different directories in one line?

I want to zip numerous files from different directories(paths) in one line. How can I do that?
15
votes
5answers
3k views

How can I edit a large file in place?

I have a few files sized > 1 GB each. I need to remove last few bytes from the files. How can I do it? I prefer to edit file in place to save disk space. I am on HP-UX.
9
votes
5answers
5k views

Keep log file size fixed without logrotate

Is there any way to keep file size of log file fixed without rotating it by a new empty file and deleting (or archiving) the old file. For example, if I set log file maximum size to 1MB, after the ...