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

learn more… | top users | synonyms (1)

16
votes
3answers
7k views

List the files accessed by a program

time is a brilliant command if you want to figure out how much CPU time a given command takes. I am looking for something similar that can list the files being accessed by a program and its children. ...
41
votes
4answers
10k views

What's the point in adding a new line to the end of a file?

Some compilers (especially C or C++ ones) give you warnings about: No new line at end of file I thought this would be a C-programmers-only problem, but github displays a message in the commit view: ...
4
votes
2answers
1k views

Access history of a file

I was wondering if there are any tools to keep track of the access history of a file. I know of stat, but as far as I understand, it only returns information about the last time the file was accessed. ...
2
votes
1answer
807 views

Can't see files on my cell phone

I have Samsung Galaxy S2 as my cell phone and Debian Squeeze as my desktop. When I connect them using USB, Debian recognize it and allows to open it with file manager. Problem: it displays only ...
8
votes
4answers
4k views

How are directories implemented in Unix filesystems?

My question is how directories are implemented? I can believe a data structure like a variable e.g. table, array or similar. Since UNIX is Open Source I can look in the source what the program does ...
13
votes
2answers
3k views

recursive statistics on file types in directory?

I did a website scrape for a conversion project. I'd like to do some statistics on the types of files in there -- for instance, 400 .html files, 100 .gif, etc. What's an easy way to do this? It has to ...
6
votes
3answers
11k views

Correct permissions for /var/www/html?

I'm able to write changes in the home directory, but when it comes to the /var/www/html folder, it's not allowing me to make any changes or create new files or folders. I'm able to view the files in ...
4
votes
3answers
10k views

How to recursively list all hidden files and directories?

I want to list all hidden files and directories and then save result to file. Is there any command for this?
2
votes
2answers
924 views

How to find human-readable information about file types recognized by `file`?

Searching, googling, I could not find any information about file types recognized by file. For example, an *.mp4 file is identified as "ISO Media" (while being able to play with VLC normally). This ...
5
votes
2answers
246 views

Is there a web site to search in the file contents of default installations of different linux distributions?

The text string "Network services, Internet style" is found in the first line of the file /etc/services on a computer running Ubuntu 11.04 erik@laptop:~$ head -1 /etc/services # Network services, ...
3
votes
3answers
367 views

How to grep recursive UNIX tree results along with each tree node?

Here is what I do tree -R /Applications/NetBeans/NetBeans\ 7.0.app/ | perl -e 'while (<>) { print if /java$/ }' but of course this doesn't return the result I want. What I want is to display ...
4
votes
2answers
275 views

Sometimes I feel like a directory, some times I feel like a regular file

For organizational purposes I would like a certain filesystem object which most of the time appears as a file, on occasion, to appear as a directory. The basic idea is that generically for cp, mv, ...
4
votes
3answers
3k views

Delete files based on year

I need to delete all files in a directory that were created in 2009. What command can I use to do that?
1
vote
1answer
877 views

Automount lookup failed. How to determine what is trying to access the file?

Is there a way to find out what is trying to mount this file? Jul 13 14:27:24 myhost automount[13527]: lookup(file): lookup for tmp_dir failed Something is looking for "tmp_dir", and I've ...
20
votes
6answers
29k views

How do I can get the size of a file in a bash script?

How do I can get the size of a file in a bash script? How do I assign this to a bash variable so I can use it later?
3
votes
2answers
105 views

Can I run a command with specific privileges on certain directories?

I would like to be able to run a command, passing in parameters to bash or similar, such that this command is not allowed to write to a particular path, overriding the user's other privs. Eg: ...
2
votes
1answer
133 views

Is there a way to determine which process creates a file on osx 10.6.8

I would like to know which process has created files on os X 10.6. I'm trying DTrace, which probably will give the right answer, but I have not eyes to see the method. I'm doing this because I think ...
9
votes
2answers
1k views

How can I delete all files in a folder that haven't been accessed in a certain amount of time?

I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
5
votes
3answers
4k views

How do I open a .bak file on Linux?

I have received a file of .bak format, let it be foo.bak. I don't know if it is a MS-DOS file or Linux/Unix file. What I know is that I can't open it because my Linux (Ubuntu) does not give any hint ...
7
votes
3answers
4k views

How can I limit downloaded file size in wget?

I want to use wget (from a php script) to download image files, but don't want to download files over a certain size. Can I limit file size with wget? If not, what is a better way?
1
vote
2answers
1k views

permission denied when executing a binary

I used these instructions to install mongodb on my OS X machine. I did not make the files owned by root though, I used my local user (markdsievers), and installed to /usr/local/mongodb and ...
3
votes
1answer
100 views

What are core.mountd.######### files? OpenSolaris

I and gaining an ever expanding list of of core.mountd.12009999475 type files in my root directory? What are these? Can I just delete them? What causes them to be created?
5
votes
5answers
19k views

How to transfer files from Windows to Ubuntu on Virtualbox?

How should I transfer files from Windows to Ubuntu installed on Virtualbox? When I plugged in a USB, it only pops up in Windows. How can I see it in Ubuntu?
3
votes
4answers
4k views

Find file by a part of its content

I have many files in a specific repository and i must find a file which has a specific string in its content (actually referencing the file Version.cc.in). What is the best solution to find it?
1
vote
1answer
1k views

remove carriage return character from large binary file

I have a large binary file ( nearly binary file ! ) which has many \r\n in it [ gets Generated in windows env and doesnt have controle over generating application ]. I want to remove \r from this ...
2
votes
1answer
15k views

How to move a file to /usr/local in Ubuntu?

I am working in the most recent Ubuntu in a 64 bit machine. I am currently on the Gnome command prompt and I am trying to move a file under the Downloads directory to /usr/local. However, it gives me ...
1
vote
3answers
422 views

Fast incremental searching of files from shell

I like the command-t script in vim editor that is able to intelligently and incrementally search for files. Is there some similar program that is able to search from shell? It would be great if it ...
4
votes
2answers
904 views

undelete files from local fileserver

I have a NAS (mybook world white light) in my living room where all my music and stuff is stored. I've mounted the music folder of the nas in the local music folder of my home directory on my desktop ...
10
votes
3answers
6k views

Delete the first n bytes of files

I've got an extreme problem, and all of the solutions I can imagine are complicated. According to my UNIX/Linux experience there must be an easy way. I want to delete the first 31 bytes of each file ...
2
votes
3answers
1k views

Building a home file server using Arch Linux

I want to create a home file server using my old desktop. I plan on using Arch Linux for this as I'm familiar with it. The desktop has 2 hard drives - the old 20gb one & a new 1TB hdd. I plan on ...
26
votes
5answers
16k views

How to determine which process is creating a file?

Given file path, how can I determine which process creates it (and/or reads/writes to it)?
0
votes
2answers
878 views

'Open .bash_profile' conflict on Ubuntu

I want to edit .bash_profile on my Ubuntu system. When I try to run the command open .bash_profile, it gives this message: Couldn't get a file descriptor referring to the console Please help me get ...
6
votes
1answer
279 views

What could cause strange behavior in file(1) command?

What could cause file(1) command to output application/msword application/msword (yes, twice in a row) as the mime type for some of the .doc files? Normally it prints just application/msword. If run ...
2
votes
3answers
1k views

Delete files if contents do not match pattern

There are hundreds of .html files in a directory. I need to delete files that don't contain word bluecar in their contents. I thought sed with rm would do that, but I don't know how to combine them.
3
votes
2answers
1k views

How many files can be saved in one directory on Linux? [duplicate]

Possible Duplicate: Number of files per directory I need to save 1 milion static html files in one directory as there is not possible to group the files into the directories (all files must ...
10
votes
6answers
5k views

What does the “number” in the owner field of files signify in linux?

I copied many files to my new linux host. I see that all files have the owner and group both set to 515. What does that mean?
12
votes
8answers
12k views

How to move 100 files from a folder containing thousands?

I have a directory with thousands of files. How can I move 100 of the files (any files will do) to another location.
2
votes
3answers
471 views

process that only root can run

I have created a process and it is running in the background as a daemon it.Now I want that only root should be able to view the output of that process.My process is something like "top" which ...
1
vote
3answers
157 views

Tool to remove all non-package files on a system

If you want to keep for example a build or server system clean, it is very useful to be able to check that all files are present and accounted for by the package metadata. At work we have a very nice ...
7
votes
3answers
4k views

Show contents of many files

From the command line, what is the easiest way to show the contents of multiple files? My directory looks like below. ./WtCgikkCFHmmuXQXp0FkZjVrnJSU64Jb9WSyZ52b ...
4
votes
4answers
13k views

Linux file access monitoring

Is there any way in unix to find out who accessed certain file in last 1 week? It may be user or some script ftp it to some other place. Can I get a list of user name who accessed certain file? How ...
6
votes
2answers
700 views

What is produced after using cat on an image?

Let's say one creates a file like so: touch myFile You enter some text in it with vim or whatever, and then use cat myFile to spit the contents out into the terminal. Now, what happens when I use ...
2
votes
3answers
1k views

How can I create multiple files in the current directory in bash?

Is there a command to create multiple files in the current directory? i.e. if I would like to create __init__.py, views.py, models.py and admin.py as follows: > COMMAND __init__.py views.py ...
2
votes
2answers
287 views

using chown in linux

I want to assign www-data user full rights in folder /var/www/ and all of the files inside this folder. I have tried chown www-data /var/www/
6
votes
1answer
674 views

How are extended attributes stored and preserved?

I have a small question about extended file attributes. Assume I label my files with metadata in extended attributes (e.g. to account for the integrity - but this does not matter for my question). The ...
1
vote
0answers
90 views

How to search for file contents [duplicate]

Possible Duplicate: Finding a substring in files across subdirectories with a single built-in command? I know that I can use grep for a single file, but what about a whole directory tree?
21
votes
4answers
78k views

How to get over “device or resource busy”?

I tried to rm -rf a folder, and got "device or resource busy". In Windows, I would have used LockHunter to resolve this. What's the linux equivalent? (Please give as answer a simple "unlock this" ...
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
3k 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 ...