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

learn more… | top users | synonyms (1)

3
votes
2answers
92 views

How to figure out what changes to which files a given command does, or even intercept them?

Say I've got a program mysterion the execution of which will probably modify some files. In order to figure out whether this is harmful or not I'd like to run it in such a way that I can at the very ...
1
vote
2answers
229 views

In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?

Stupidly, I had been using a condition like this as part of a script: if [ $(ls FOO* 2> /dev/null) ] # if files named "FOO*" were downloaded then echo "Files found" # ... process and ...
0
votes
1answer
86 views

In shell script, execute a command only if the source is newer than the target

I'm looking for a simplified version of this: dep=0 if [ ! -e targetfile ] then dep=1 elif [ targetfile -nt sourcefile ] then dep=1 fi if [ $dep -eq 0 ] then echo "Already up to date" ...
0
votes
3answers
96 views

Which of the following files are true orphan (lost) files and can be safely removed?

I am using a script called lostfiles to list all orphaned (lost) files which do not belong to any package on my Arch Linux system. Whilst for most files I am fairly sure that I can safely delete them ...
0
votes
2answers
78 views

Using Pipeline to Direct Files to Program that Opens Them

I have a Music folder, in which I have some music tracks, which aren't organized too well. Thus, if I want to find a particular track, I usually type: ls Music | grep <keyword>, where ...
0
votes
1answer
103 views

How to hide file size using ls command

I need to list some files in a directory using the ls command, but I need to also to hide the file sizes. How can I do that with the ls command?
2
votes
1answer
143 views

Hang during 'touch' operation on NFS mount

I have two NFS clients mounted to an openfiler 2.99 NFS share at 192.0.2.3: 192.0.2.1 mounts 192.0.2.3:/mnt/nfs01/volnfs01/share01 with ...
0
votes
3answers
119 views

thoroughly find all links (hard and symlinks, and any combination thereof) leading to a file/dir

I read "most" of the proposed questions, but I believe they all miss the complexity of the right answer. I want, only using "basic" commands (for maximum portability) (i.e., something that would work ...
5
votes
1answer
105 views

How do I find the full history of a file?

I need to know the full history of a file, like if someone changed or moved it to some other places since the time when it is created.
3
votes
3answers
70 views

Disallow File IO for a process except for FIFOs

How do you start a process that cannot do any file IO (opening / closing files, creating / deleting files, reading / writing files, etc.), except to read and write to pre-created FIFOs? (chroot will ...
4
votes
4answers
142 views

Clean way to temporarily replace a config file?

I use a drawing program called Inkscape, which has both a GUI and a command line interface. When used on the command line, it has a large number of options that can only be controlled through a ...
1
vote
2answers
104 views

Display the number of bytes, words and lines in a file

I want to create a shell script df. As, I want to type in df name_of_file and then I can get the contents of the file. If the file name is in the directory, I want it to show its contents. If not, I ...
3
votes
3answers
112 views

Find directories without music files

My ~/Music/ directory is actually full of "empty" directories I want to clean. I say "empty" because this directories actually contain files, some contain old cover image files or Thumbs.db files. I ...
1
vote
2answers
192 views

How do I trigger a script when a folder is updated in Solaris 5.10?

We are trying to write a script to move away files as soon as they drop in a folder. One way of achieving this is running rsync in a script on cron scheduler. The problem with this approach is the ...
2
votes
1answer
82 views

Cannot remove file on NTFS partition, event as root

I have a dual boot system, and use a NTFS partition as universal storage between Windows 7 and Ubuntu. Lately, that partition has been throwing CHKDSK prompts on Windows boot, so I thought it was a ...
3
votes
2answers
178 views

How to find frequency of occurrences of strings contained in a file?

I have a file that contains a list of URLs of the form EDIT http://www.google.com/absd/siidfs/kfd837382$%^$&, www.google.com, google.com yahoo.com/list/page/jhfjkshdjf... I ...
1
vote
1answer
33 views

Get last changed content since last read

How can I get the last changed content of a file, since its last read? Something more precise that this: tail - <nr >file_1.txt >file_2.txt where file_2.txt gets the last modified ...
0
votes
2answers
60 views

need help in making script [duplicate]

I want to automate one task in UNIX and make one script. There is directory in which everyday 2 files comes and that files come anytime in between 10 pm to 1 am. file name is ...
4
votes
1answer
51 views

Map file to URL

I'm looking for a way to do something like this: some_tool --go-to-background http://server.com/~me/uber_vimrc ~/.vimrc After which, reading ~/.vimrc would give the data downloaded from that URL. ...
11
votes
4answers
485 views

How am I supposed to edit files on a network with Vim?

Currently I'm doing it by SSHing into a server, and executing Vim on the server. This has the benefit of not having to deal with cumbersome syntax of opening files from a remote server over SCP, and, ...
2
votes
1answer
77 views

tar and if-statement

I have a script that check if a file exist inside a tar file but something's wrong because it always go to the else part of the script. I am pretty sure that it shouldn't be that way. The date is in ...
-1
votes
1answer
93 views

Select a range of files from directory structure /year/month/date.db

I have databases stored in the directory structure year/month/date.db an example would be db/2013/10/15.db I need to be able to select a range of these with a script ("dbSelect ...
-1
votes
1answer
211 views

How to recursively move batches of 20 files into numbered folders from folder of 1000 files

I have a folder full of 1000 (or more) files. I want to have a script that creates a numbered folder and then moves the first 20 files (ordered by name) into that folder. It should then do this for ...
1
vote
0answers
52 views

Which Unixes support cross-device filesystem links (in particular for rename)?

Just read the following on the FreeBSD man page for the rename syscall: ... [EXDEV] The link named by to and the file named by from are on different logical devices (file systems). Note that ...
0
votes
1answer
36 views

In which way is a commented line active in a program file?

To solve the bug reported here the solution seems to be commenting, not just adding a certain line in a file - as explained here and here. That is - to make that bug disappear in Xfce, a certain line ...
1
vote
0answers
45 views

How can I make Krusader show real size of symlinked files?

In the "size" column in Krusader, there is a link's size noted, instead of the size of the actual file. This is the same as what ls -l shows (the full address of the target file, e.g. 64 B instead of ...
1
vote
3answers
91 views

How to rename files and directory with *.~1~ suffix to original name?

I have a directory named underscore.~1~ and several files inside with names like main.js.~1~, index.js.~1~ etc. How can I rename the directory underscore and the files inside to the original names ...
3
votes
4answers
397 views

permissions 755 on /home/<user>/

I am wondering why by default my directory /home/<user>/ has permissions set to 755. This allows other users to enter into directories and read files in my home. Is there any legitimate reason ...
4
votes
1answer
100 views

Use case of providing file-like API to terminal/console

It was explained in this Stack Overflow thread that each logical terminal has a "pseudo-terminal", and that writing to one: $ cat some-file.txt > /dev/ttys002 will cause the data to appear in ...
2
votes
1answer
52 views

Keep track of all files accessed by a specific process?

There has recently been a (publicly unconfirmed) report that Skype is accessing files that it shouldn't be, without user intervention. I have no idea if this is the case with Skype on linux, but it ...
2
votes
5answers
146 views

Delete all files in directories except those whose path are listed in a file

Given the following files: data/A/a.txt data/B/b.pdf ... date/P/whatever.log ... data/Z/z.jpg I would like to delete all files in the data/A/, data/B/, ..., data/Z/ directories except those files ...
2
votes
1answer
94 views

Why does copying from a script screw with my files?

I am at a loss here, trying to find out the reason why a shell script that is basically copying a couple of files and directories from one place to another will result in the content of two of the ...
1
vote
1answer
47 views

multiple conversion bam to bed using bedtools

I have ten .bam files (bioinformatic format) and I would like to convert it to 10 .bed files, but for this conversion I need to use special command bedtools bamTobed -i (input file) > output ...
2
votes
4answers
115 views

How to start processing a file at an offset?

Use case: You've got a multi-GB log file for a whole week, and you need to search for something which happened on Saturday using for example grep. Making an educated guess, you assume that starting ...
0
votes
1answer
519 views

Zabbix-agent: cannot stat 'filename.log': [13] Permission denied

I have installed Zabbix-server and zabbix-agent and trying to add trigger to check log file. But in /var/log/zabbix/zabbix_agentd.log I got the same error every time: 10832:20131008:125634.180 ...
5
votes
2answers
179 views

A virtual file containing the concatenation of other files

Is there a way of creating a filesystem object akin to this: mknod files p cat file1 file2 ... fileN > files but such that it can be seeked in, as if it were a regular file?
4
votes
1answer
193 views

How search for a file beginning with either a or z and ending with a or z?

I attempted find -name 'a*' 'z*' '*a' '*z' but it gave me the error code find: paths must precede expression: z* I know how to find files starting with a though z, or ending with a-z, but not ...
0
votes
1answer
80 views

Get a clean list of files transferred from rsync

I'm trying to get an itemized list of files transferred by rsync. Using the -i and --out-format options, I'm instead ending up with output that looks like this: 3HMP1MO_001.tif 974.68K 100% ...
4
votes
2answers
107 views

Find and differences between -perm /6000 and -perm /u+s

I have been trying to find setuid executables using a `one liner'. The line I first tried was: find / -perm /u+s -type f Then I found a line which is similar but gives different results: find / ...
1
vote
5answers
800 views

Find files by the length of filename

I want to find all files by length of the file names. For example if I want to find files of length 1, such as a.go, b.go I put: grep '.\{1\}' file But this does not work. What command can I use ...
1
vote
2answers
149 views

What the “+” and “-” buttons do in Pantheon-files (files manager in Elementary OS)?

When setting the view to "Grid" in Pantheon Files (Elementary OS), there is this option to click a "+" or "-" button on folders and files. What is that? After clicking the "+", this may be ...
1
vote
0answers
1k views

How to edit context menu in Elementary OS' Files manager (pantheon-files)?

(I am new with Elementary OS and am not sure how to ask questions on their website. So this might be a cross-posting; I cannot find my question posted there.) I have seen here that the entries in the ...
3
votes
2answers
133 views

Join: Two files - but only append last two columns

Given the files: 1.txt 1, abc, 123, 456, 789 2, lmn, 123, 456, 789 3, pqr, 123, 456, 789 2.txt 1, abc, 123, 000, 000 3, lmn, 123, 000, 000 9, opq, 123, 000, 000 OUTPUT.txt ID, NAME, X, ...
1
vote
1answer
3k views

How to add 'open folder as root' in Elementary OS file manager context menu?

Here it is the solution in order to add the 'open terminal here' into the context menu of Elementary OS' file manager (generically called 'Files' - the executable is pantheon-files). For that ...
3
votes
3answers
184 views

Command for taking a screenshot to a new file

I want to configure a global hotkey to take a new screenshot and save it, say, somewhere inside my home folder. I can take a screenshot with ImageMagick with this command: import screenshot.jpg ...
3
votes
2answers
74 views

File Permissions mode ending in @ or + [duplicate]

I was changing file permissions and I noticed that some of the permissions modes ended in @ as in -rw-r--r--@, or a + as in drwxr-x---+. I've looked at the man pages for chmod and chown, and searched ...
1
vote
4answers
274 views

monitoring file changes + process access to files

I would like to see what's happening in my app server folders, which files are changed by process x or which *.war files has been changed (replaced/created) in last x minutes. I am software developer ...
0
votes
1answer
702 views

Run .sh file instead of opening it

I am using Zorin OS 7. I want to run a .sh file but I can't seem to be able to—it just opens in a text editor. Also under RMB>open with there is no other option.
3
votes
1answer
59 views

Print out file structure on Unix

Is there a way on unix to print out the file structure, like Bootstrap's getting started page? bootstrap/ ├── css/ │ ├── bootstrap.css │ ├── bootstrap.min.css │ ├── bootstrap-theme.css │ ├── ...
4
votes
1answer
287 views

How to use nemo actions to mount an iso file?

I read these articles: https://wiki.archlinux.org/index.php/Nemo https://wiki.archlinux.org/index.php/Mounting_images_as_user and try use Nemo Actions to mount iso files but nothing happened ...