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

learn more… | top users | synonyms (1)

4
votes
0answers
153 views

Move a file and re-target all of its symlinks [duplicate]

Possible Duplicate: How can I “relink” a lot of broken symlinks? Is there any way to move a file to a new location, and then re-target its symlinks to the new location, using a shell ...
11
votes
2answers
1k views

How to separate Awesome's `rc.lua` configuration into multiple files?

I've just moved to Awesome WM from OpenBox. I like that it's very extensible, customizable and I have huge control about window layout. I like structured and organized things and I'd like to separate ...
4
votes
5answers
3k views

Gedit won't save a file on a VirtualBox share: Text file busy

I have a text file that I can change using other applications (for example openoffice). But when I try to change and save it using gedit, I am getting error from gedit: Could not save the file ...
6
votes
5answers
993 views

Find images by size: find / file / awk

I've been trying to find png image files a certain height (over 500px). I know that file will return image dimensions. Example: $ file TestImg1a.png TestImg1a.png: PNG image data, 764 x 200, ...
-1
votes
1answer
220 views

How to add a string of numbers to multiple text files in a directory?

file.txt file2.txt file3.txt I want to add 99999 to the begining of the all the file names without changing anything else in the file name in solaris 10.
11
votes
3answers
2k views

Flattening a nested directory

This is probably very simple, but I can't figure it out. I have a directory structure like this (dir2 is inside dir1): /dir1 /dir2 | --- file1 | --- file2 What is ...
1
vote
2answers
96 views

Is there some kind kind of hosts.additional file for Linux

If you have a list of servers all linking to each other by static addresses, is there some kind of hosts.additional you can use as some kind of file based DNS? ie The hosts file contains static ...
3
votes
1answer
168 views

How to create a folder which will change its contents’ ownership to what the folder has?

In a GNU/Linux OS there is no way to change ownership of a file until you are root. But what if I want to hide my system’s username e.g. before sending a file to someone, because some things like tar ...
2
votes
2answers
968 views

File delete versus overwrite and link at /proc/pid/fd

It is well known that UNIX systems won't actually delete a file on disk while the file is in use. So if a file is being accessed by process 1 and process 2 deletes the file using rm, process 1 ...
7
votes
4answers
741 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 ...
3
votes
2answers
317 views

linux disk caching affects access times reported by stat?

On Ubuntu 12.04 I did the following stat a file cat the same file stat the file again cat the file again after 5 min stat the file The access time reported at 3. reflects the point at which 2. was ...
3
votes
2answers
356 views

Fastest way to get list of all file sizes

I'm trying to create a graph of the distribution of file sizes on my ext4 system. I'm trying to write a script to scrape this information from my computer somehow. I don't care where the files are ...
5
votes
3answers
882 views

Can't read a file although it's in my group and permissions for group read are set

I encounter a strange problem on a unix/linux machine: I'm member of a group, let's call it group A and a certain file (which has a different owner) belongs to group A as well. The permissions of ...
4
votes
1answer
297 views

How to rename all files and add image size to file name

I can`t make this work. I have a lot of images and i want to rename his name and append image size to name using exiv2 eviv2 pr * prints all info about file # exiv2 pr 9b523e5a002268fe5067a928 File ...
1
vote
5answers
687 views

Run a command on all the files in a directory tree and put the output into a variable

I want to run this bash command : #!/bin/bash rep="*" for f in `ls -R`$rep; do d='git log '$f'| wc -l' c=$d echo $c done how to excute a command git log myFile | wc -l from bash ? ps : this ...
4
votes
2answers
445 views

List files created on Sundays

How do I list/find all the files created on Sundays or Mondays? How do I use the date parameter to display them? Something like : ls -f date + %a or find -type f | date +%A or find -type f ...
3
votes
2answers
846 views

How can i redirect the output to a file when the program is build with ncurses library [duplicate]

Possible Duplicate: Removing control chars (including console codes / colours) from script output If we redirect output to file in this pattern top >> somefile.txt, we get lot of ...
17
votes
2answers
6k views

What happens when you delete a hard link?

If you do rm myFile where myFile is a hard link, what happens?
4
votes
2answers
212 views

Shredding everything: files/folders and corresponding filenames

Using find, it is easy to shred a directory's contents recursively (as discussed in this question). However, sometimes the filenames on their own carry sensitive information already. Is there a way to ...
1
vote
3answers
144 views

Deleting the starting 10 MB from a open file

I have a log file of size nearly 100 MB which is opened by some program and logging is continuously going on in that file. I want to delete the first 10MB from that file. Is there any way to do that ...
1
vote
6answers
3k views

ls: Do not show directories that match same pattern in wildcard searches, only files

Supposing I have something like the following, a typical business PC situation: drwxr-xr-x 1 whatever whoever 3 Oct 3 16:40 invoices2009 drwxr-xr-x 1 whatever whoever 4 Oct 3 16:40 ...
4
votes
1answer
104 views

In Emacs, how do I inspect what has been modified in a buffer (before saving and overwriting the file)?

In Emacs, how do I inspect what has been modified in a buffer (before saving and overwriting the file)? (In a sense, the requested action is an analog of git status and git add -i showing what has ...
6
votes
1answer
4k views

Cannot delete a file - permission denied - why?

[db2inst1][testing ~/sqllib/db2dump] rm db2diag.log rm: cannot remove `db2diag.log': Permission denied [db2inst1][testing ~/sqllib/db2dump] id uid=1002(db2inst1) gid=107(db2iadm1) ...
7
votes
2answers
259 views

Search MP3/Ogg files by tags/parameters from the command line

Is there any utility to search MP3/Ogg files by tags (or other characteristics) from the command line? (e.g. finding all audio files longer than 10 minutes with genre set to 'Rock'). I found this, ...
2
votes
4answers
7k views

How to permanently change the file/directory permission [closed]

How do I change the permission of file/directories such that I am able to create, edit, delete files/directories anywhere in my system? Currently I am using Ubuntu 12.04. I tried sudo chmod 777 -r ...
3
votes
4answers
1k views

Modification and Access time of a file?

Is it possible to change the file modification time without changing the file acess time?
3
votes
1answer
476 views

Confused about ident

I inherited a bunch of files that begin with the following statement at the top Ident:/some/path/to/a/file Ident seems to be related to C coding and make files but I am not really sure. None of the ...
0
votes
1answer
759 views

Asking ls to only list files in a path that match a specific glob/regex

In Zsh: Is there a way to use ls to only list files and folders in the current directory that match a specific globbing or regex pattern? For example, say I have multiple files that start with the ...
4
votes
1answer
1k views

For filenames, are underscores or dashes more common in Unix file names?

When you are naming files with multiple words in the name, is it more common in Unix systems to use underscores, camel case, or dashes to separate the words?
3
votes
3answers
291 views

Why do I get 3048 MB from a 64 MB flash memory?

I have a Linux based STB (set-top-box) and it features a 64 MB flash memory and 256 MB of RAM. I wanted to take a backup of some of my settings before I flash it with another image, but I wasn't sure ...
31
votes
2answers
12k views

Why can rm remove read-only files?

If I create a file and then change its permissions to 444 (read-only), how come rm can remove it? If I do this: echo test > test.txt chmod 444 test.txt rm test.txt ...rm will ask if I want to ...
6
votes
7answers
11k views

List only regular files (but not directories) in current directory

I can use ls -ld */ to list all the directory entries in the current directory. Is there a similarly easy way to just list all the regular files in the current directory? I know I can use find find . ...
6
votes
4answers
1k views

List X random files from a directory

Is there a way to list a set of say, 30 random files from a directory using standard Linux commands? (in zsh) The top answer described here does not work for me (sort does not recognize the option ...
3
votes
1answer
961 views

What do you filter / exclude list when doing backup with rsync? [closed]

I'm trying to build a comprehensive filter / exclude file, to prevent backuping stuff that doesn't make sense do backup, such as temporary / cache data or easily recreatable files. I would appreciate ...
1
vote
1answer
96 views

Will files created under source directory after running `cp` be copied?

Suppose I use cp to copy a directory to another place. If the process takes long, and I create a new file under the source directory, will it be copied, or does it depend on something?
2
votes
2answers
230 views

Create a new link to access all files and folders

I get stuck to create a shell script for a new link something like that link linkPathName orginalPathName I want to create a link between a new link and original path; however, both can access ...
5
votes
1answer
143 views

Does the suid bit have any meaning for device files?

Does the suid bit have any special meaning for device files in Linux ?
4
votes
3answers
595 views

id3v2 used recursively at command line?

Trying to get my id3 tags cleaned up and am loving id3v2 on the command line -- but I've been using it only with a *.mp3 wildcard and want to explore if there's a way to use it recursively so I can ...
5
votes
1answer
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 ...
5
votes
2answers
3k views

Unpack files and directories from an image created by dd?

I created an image of an NTFS partition using dd. I wonder if I can unload/unpack the files and directories in the image to any partition whose size is larger than the image size, so that I can ...
6
votes
1answer
4k views

Group within group file permissions

I tried finding this on here, but couldn't so sorry if it's a duplicate. Say I have 2 groups and a user: group1, group2, user1 with the following structure: group1 is a member of group 2, user1 is a ...
2
votes
1answer
121 views

Read only new parts of a file?

I have a large CSV file, that grows by some entries every day (created by an external software which writes always to this one file, no splitting possible). For performance reasons and further ...
2
votes
1answer
533 views

Regarding generating intersection and union of two csv files

I have two csv files, there are some overlap columns between these two files. Assume one file is called as A.csv and another is called as B.csv. The intersection of A and B is called as C. I would ...
4
votes
3answers
1k views

shell script to read from multiple files in parallel

I need to write a script that runs parallel and looks for a string in multiple files. I tried a lot of options but they slow down the speed of my processor.
2
votes
1answer
126 views

How to run a command against all the files of particular types on a filesystem?

I've just recovered tons of files (distributed in a complex directory structure, having very long names, using Unicode symbols, spaces etc in names) from a damaged hard drive. Now I'd like to verify ...
1
vote
3answers
534 views

Merging files into one also adding a new line between each file

I'm using find . -type f \( -name "*.js" ! -name "*-min*" \) -exec cat {} \; > all.js to merge files together. Unfortunately I don't get a new line after each file but it ends and the new file ...
7
votes
2answers
2k views

Can files be created with permissions set on the command line?

When creating directories, mkdir -m <mode> <dir> provides for creating one or more directories with the given mode/permissions set (atomically). Is there an equivalent for creating files, ...
1
vote
1answer
188 views

TeXstudio: open file at line number n

I am creating a script to produce some .tex files with a lot of lines (a kind of automatic sample). The script finishes with texstudio /home/$USER/foo.tex where foo.tex is the file created before. ...
2
votes
2answers
884 views

How to make duplicates with different names from a single file? [closed]

I want to duplicate the contents of a file. Suppose there is a file named "Hydrogen.element". I want to duplicate the contents of this file with a different name ie.make another file named ...
34
votes
3answers
22k views

How to tell gzip to keep original file?

I would like to compress a text file using gzip command line tool while keeping the original file. By default running the following command gzip file.txt results in modifying this file and renaming ...