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

learn more… | top users | synonyms (1)

5
votes
2answers
476 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
1k 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
329 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
236 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
3k 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
216 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
2k 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
253 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
8k 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
477 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
612 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
4k 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 ...
1
vote
1answer
3k 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
70 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
593 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 ...
2
votes
2answers
236 views

Linux shared FTP: one file must not be deleted

Two users: A1:x:1001:1002::/home/A1:/bin/sh A2:x:1002:1002::/home/A1:/bin/sh One group: A1:x:1002: FTP server: fresh install ProFTPd OS: fresh install Ubuntu Server 12.04 One folder (/home/A1) ...
3
votes
4answers
2k 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) ...
25
votes
6answers
33k views

How to find creation date of file?

I want to find out the creation date of particular file, not modification date or access date. I have tried with ls -ltrh and stat filename.
5
votes
3answers
1k views

Maintain (or restore) file permissions when replacing file

I have a command that accepts a file as an argument, modifies the file, then writes it to the file name specified in the second argument. I'll call that program modifyfile. I wanted it to work "in ...
3
votes
2answers
2k views

File descriptor and fork

When a child is forked then it inherits parent's file descriptors, if child closes the file descriptor what will happen ? If child starts writing what shall happen to the file at the parent's end ? ...
5
votes
5answers
733 views

How to concatenate two files on the fly and reference result as new file?

I want to concatenate two files, i.e. staticEntries.dic and dynamicEntries.dic. As the names might show, the content of staticEntries.dic stays the same over time (contains common words), but to the ...
2
votes
2answers
2k views

Monitoring file locks, locked using flock

I would like to get a list of pid's which hold shared lock on /tmp/file. Is this possible using simple command line tools?
1
vote
0answers
727 views

How to recover: Deleted accidently important files [duplicate]

I've accidentally deleted today the /var/www with 2 Joomla-Homepages on it. Is there any possibility to recover all these files? I'm using PhotoRec right know, but the recovered files are named like: ...
3
votes
2answers
2k views

Automatically moving files to a directory, one by one, and only when the target folder is empty

Is it possible? And in reverse alphabetical order? Essentially, this: How can I move files by type recursively from a directory and its sub-directories to another directory? Except that each file is ...
7
votes
3answers
690 views

Generate new name for moved file to prevent overwriting?

How can I generate a new name for a file if there's an existing file With that same name? In a Desktop environment a new name is generated my appending a number to the end of the file name, but how ...
2
votes
1answer
256 views

What file type categories do colors in the terminal represent in various distros (by default)?

I'm discovering new file type categories (if one can call different colors in the terminal in such a manner) almost on a daily basis. Still, I haven't found an exhaustive list of all recognized file ...
0
votes
3answers
320 views

Is there a way to merge two files smartly? [duplicate]

I have two files with some lines being the same. File A : command 1{ some code lines } command 2 command 3 command 4{ some code lines } File B : command 5 command 3 command 1{ some ...
8
votes
1answer
446 views

Do any archive utilities exist that can preserve the date created file attribute on NTFS-3G?

I tried the -X switch on zip, but that did not save the date created attribute. I can get it using this method. When a file is added to a zip archive using 7-Zip, it preserves the date created and ...
3
votes
0answers
71 views

How do I recursively set the date created attribute to the date modified attribute on NTFS-3G?

In my first question, I asked how to get the "Date created" field in NTFS-3G. Now, that I know I can get the "Date created", I have started adding files onto my NTFS-3G partition and would like to set ...
3
votes
3answers
181 views

Transforming text to tabular form

I have a text file with the following structure: aaa bbb ccc ddd eee fff 1 2 3 4 5 6 1.1 1.2 1.3 1.4 1.5 1.6 ggg hhh iii jjj kkk lll 7 8 9 10 11 12 2.1 2.2 2.3 2.4 2.5 2.6 and I want the ...
0
votes
1answer
136 views

Linux commands to fetch all files,size and path of files from all directories and subdirectories

Can anyone please guide me, how do I use Linux commands in PHP code to fetch all files names and their size and path of files from all directories and subdirectories. I am running a scan code. where ...
12
votes
1answer
6k views

Empty the contents of a file

I am aware of three methods to delete all entries from a file. They are >filename touch filename filename < /dev/null Of these three I abuse >filename the most as that requires the ...
0
votes
3answers
7k views

need to move files to different folder based on the creation date [duplicate]

I have set of files created from Monday to Friday.. a -- > 08/20 a1---> 08/21 a2---> 08/21 a3---> 08/21 a4---> 08/22 a5 --> 08/23 I need to move only 08/21 file to diffrenet ...
7
votes
5answers
18k views

Add lines to the beginning and end of the huge file

I have the scenario where lines to be added on begining and end of the huge files. I have tried as shown below. for the first line: sed -i '1i\'"$FirstLine" $Filename for the last line: sed -i ...
2
votes
2answers
147 views

How to automatically apply changes in a folder to another?

Running Ubuntu 12.04, I work software "production" on certain folders and then I usually copy files I make up to another paths where I do the "deployment". For example, sometimes I produce some files ...
2
votes
1answer
390 views

Renaming files based on the contents of a text file

I have lots of point files I need to change for model input. I want to rename lots of these files based on the contents of a file. These files are text files arranged in rows. file name: ...
1
vote
5answers
134 views

how to merge different files that have the same header but slightly different file name?

I have a problem in merging files for a big data sets like below. I want you help me to let me know the script that can do such task. fine name: fluxes_year_lat_long I have 30 years of daily fluxes ...
1
vote
2answers
2k views

Find and move directories based on file type and date

I have a directory "New Movies" containing 200+ subdirectories "Movie Name (year)". The subdirectories "Movie Name (year)" contains a single video file (avi/mkv) and several related jpg/xml files. I ...
4
votes
2answers
417 views

Overwriting an input file

Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility. Stephane Chalezas's answer here indicates another ...
2
votes
4answers
4k views

Shell script to check for the presence of one or more files with a specific extension?

I want to write a script to find a file with specific extension.this much i have done: #!/bin/bash file="/home/Savio/Dsktop/check/*.csv" file1="/home/Savio/check/*.txt" if [[ -f "$file" && -f ...
1
vote
1answer
94 views

Strange problem with IO or file system or what?

On a SLES 11 SP2 32-bit system I'm seeing a strange problem. It's as if the OS can not open a file from the beginning of the file. Say I have a file that is 200 lines. If I cat or more or vi the ...
3
votes
1answer
5k views

copying files from one directory to another

I have to copy a set of files from one folder to another folder and I'm using the following command: cp -rf `head -n 100 /home/tmp/abc.txt` /home/tmp/test/files the file contents in abc.txt is ...
3
votes
3answers
2k views

How to determine how many files are within a directory without counting?

I've been having a fairly serious issue on a high traffic web server. PHP pages are slowing down considerably, and it only seems to be an issue on pages where sessions are accessed, or a certain table ...
3
votes
1answer
104 views

Files have the same inode but they don't link to each other

I have a bash script in two places and I can't remember how I created them. they have the same inode but none of them seem to link to another. is there a hard link but should not Links count for that ...
25
votes
8answers
33k views

How do I loop through only directories in bash?

I have a folder with some directories and some files (some are hidden, beginning with dot). for d in *; do echo $d done will loop through all files, but I want to loop only through directories. ...
3
votes
3answers
4k views

How can I change the date modified of a folder to the last changed file inside? [duplicate]

In my media center directory all modified times of my folders are somehow not the desired date. How can I change all modified times of the main folders to the modified time of the newest media-file ...
0
votes
1answer
60 views

Get the most recent backup files [duplicate]

I'm googling for this, but the terms are so generic I'm getting way too many false positives, so what the hey, I'll ask here. I'm sure there's a simple answer but I don't generally script in *nix. ...
3
votes
2answers
2k views

Finding sparse files?

Is there a straightforward way to find all the sparse files on my system, or in a particular directory tree? If it's relevant, I'm using zsh on Ubuntu 12.04, although a more generic Unix-y answer for ...
2
votes
2answers
249 views

Symbolic link of for my user, doesn't work for root

I am experimenting with the following scheme in order to share common data among different distributions. In Fedora I have created a symbolic link /home pointing to: ...
3
votes
1answer
829 views

viewing dll and exe file properties/attributes vi command line

I have a need to see some additional file properties for exe and dll files. If I open windows explorer and add the additional columns to my view, I can see things like Company, Copyright, Product ...