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

learn more… | top users | synonyms (1)

2
votes
2answers
18 views

Are files defined by their content blocks, inodes, both, or filenames?

Are files defined by their content blocks, inodes, both, or filenames, or something else? Fundamentially, what is the definition of a file? E.g. two hard links can share the same inode and thus ...
2
votes
1answer
26 views

Clustering identical files ignoring spaces & linebreaks

Consider a folder with many XML files (10K small text files). Some XML files are identical, some are different. I would like to find out what files are identical (ignoring whitespaces, tabs and ...
2
votes
2answers
34 views

Efficient search of unique owners of files and directories

I would like to view the unique owners of all the files and directories underneath a certain directory. I have tried: ls -ltR <dir-path> | grep -P '^[d|\-]' | awk '{print $3}' | sort | uniq ...
1
vote
2answers
30 views

Relation between timestamps of files

If I am correct: atime is the last time the file was read/accessed. mtime is the time when the file content last modified. ctime is the time when the inode of the file, was last changed. ...
-1
votes
0answers
35 views

creating new filesystem?

Is it possible to create directory/filesystem that would be beyond unix-like filesystem ( I mean "/" ) so when I will use command pwd , its output would be "example_folder" not "/example_folder" . I ...
1
vote
2answers
35 views

Search and Delete duplicate files with different names

I have a large music collection stored on my hard drive; and browsing through it, I found that I have a lot of duplicate files in some album directories. Usually the duplicates exist alongside the ...
2
votes
2answers
33 views

Find files created by a particular user

How would I go about discovering all of the files created by a particular user and display them to the screen? I've started a script that prompts the current user to enter the username of whom they ...
-1
votes
1answer
26 views

Advice with How to Return the # of Files found within a folder [duplicate]

Create a script to ask a user for the name of a folder and have the script return the number of files found within the folder. If folder doesn't exist, display error message to the screen I've gotten ...
0
votes
1answer
167 views

How can I delete files on a read-only file system?

I have an encrypted .dmg file with some useless files that I need to delete to make space. How can I delete them without having to convert them into a read write system and then back? (Would take 4~5 ...
1
vote
2answers
34 views

Read the file from one Unix server to the other Unix server

I have a Pro*C program which I run on Unix server a but the input file required for this program is on other Unix server b. Whenever I run I have to copy the file from server b to a. Is there any way ...
0
votes
2answers
23 views

Precaching the list of files of the filesystem

I was wondering where and in what form a list of files and directories is stored on the ext4 filesystem. The problem is that whenever I try to access a certain directory for the first time since boot ...
-1
votes
2answers
29 views

Extracting certain data within a script output file

We have a script that runs several commands and rolls up all the output and inserts in into a log file. One of the commands it runs is "netstat -anp". I'd like to be able to search this file for all ...
1
vote
2answers
119 views

How would I use sed or awk to extract certain lines in a file

If I wanted to search for all lines in a file that start with a date, such as "May 1", how would I do that with sed or awk? I need to extract this data and either send to screen or a file. Thanks.
0
votes
2answers
34 views

Find command returning wrong data [duplicate]

I am using this command to list all files that have been modified in the last day (or created) find ./ -mtime 1 -ls However it keeps returning files from 30th April when I am running the command ...
2
votes
3answers
34 views

Create many files with random content

I am looking for a command to create multiple (thousands of) files containing at least 1KB of random data. For example, Name size file1.01 2K file2.02 3K file3.03 5K ...
2
votes
2answers
71 views

List files recursively in Linux CLI with path relative to the current directory, max 250 char

I'm trying to list all the files with names no longer than 250 characters (including the directory it is part of, from the relative path my command is inside). I've seen a similar thread , but that ...
0
votes
0answers
53 views

Script to rename files [closed]

I was fixing my freenas movies and subtitles files and realized a script would help a lot. The point is I must replace the files in some directory to something like S01E02.avi, for example. In order ...
0
votes
0answers
27 views

Regex for a non-fixed pattern

I am trying to come up with the right regex (compatible with python) that would match a file that contained sample input as follows: On the third day of Christmas my true love sent to me: three ...
5
votes
2answers
186 views

What are .serverauth.##### files in my home directory?

The files are .serverauth.##### where ##### is a 5-digit number. I have a handful of these files in my home directory with a broad range of creation dates spanning a couple of years. What are these ...
0
votes
1answer
15 views

Incrontab / Incron on Cygwin

Does anyone please know if it is possible to install incron/incrontab within Cygwin? I've had a look and the package does not appear on the cygwin website, I wondered if anyone had tried, knew of any ...
-6
votes
0answers
42 views

Adding a character to the end of a word [closed]

I have a text file and I want to add a character attached to each word of the file.
1
vote
2answers
104 views

Why is there a file called [ in my /usr/bin directory? [duplicate]

Recently back to Linux from another operating system I noticed a file called [ which seems strange to me. What is it for? $ ls -l /usr/bin | head -2 -rwxr-xr-x 1 root root 39552 Nov 3 14:44 [ ...
0
votes
1answer
21 views

How to fix ntfs file problem when there is now windows?

I have a "stubborn" file on an NTFS partition which refuses to be deleted. A little background on the problem... Problem happened when I was running Zim on my Linux and the system froze due to some ...
1
vote
1answer
50 views

What is this file: .readahead doing in my root directory?

When I do: ls -a / on Fedora 21 there is a hidden file named: .readahead and it's 104092k What is this file?.... is it suppose to be there? I found this on google: readahead system call on ...
1
vote
2answers
37 views

How do I get a count of file references inside a folder of files with those references?

Alright, I have two folders. For simplicity's sake, I'll call them people and animals. The animals folder has a file for each animal, and the people folder has a file for each person with references ...
2
votes
1answer
79 views

How can I check if rsync made any changes in bash?

I have a script which uses rsync to sync data in a remote -> local scenario. Immediately after the rsync command is run, a check to see if the error code equals zero or not. If its zero, further ...
6
votes
1answer
215 views

What three files are always opened by a process?

Someone mentioned that there are three different files that a process always opens. What does this mean? What files are they?
0
votes
1answer
43 views

command “find … -exec mv …” created a file with strange content

I wanted to move binary files from folder /myhome/sourcedir to /myhome/targetdir. I used a command find /myhome/sourcedir -type f -cmin +3 -exec mv '{}' /myhome/targetdir ';' Folder /myhome/sourcedir ...
2
votes
1answer
37 views

Using wget, how to download to a specific location, without creating folders, and always overwrite original files

How do I use wget to download files to a specific location, without creating directories, and overwrite the original every time. I've tried using the -r -P and nc options in combination but this ...
0
votes
1answer
28 views

Understanding syslog rotation, to implement own syslog rotation

I am trying to implement a simple syslog server (UDP based). On this , we are trying to implment SYSLOG rotation feature. Currently the roatation of logs is done by rename C API. By doing this we ...
0
votes
1answer
39 views

How do I copy all files that have been created or modified in the last 12 months?

I would like to copy all the files created in the last 12 months to a new folder leaving behind everything else. Including sub folders.
0
votes
1answer
21 views

What is the file type “raw G3 data, byte-padded”

I ran $ find ~/ |xargs file|grep -i -e SQLite just to understand what programs use sqlite. I started seeing lines like /home/alord/hg/cpython/.hg/store/data/_modules/__sqlite/cursor.c.i: raw G3 ...
3
votes
2answers
64 views

List direct symbolic links (links that don't point to another symlink)

I need to make a list of all direct symbolic links in a directory, i.e. symbolic links that point to another file which is not a symbolic link. I tried to do it this way: for i in $(ls -1A); do ...
1
vote
1answer
44 views

ext4 disk space not reclaimed after deleting files

I recently got a "device full" warning for a 2 Tb external ext4 drive. I deleted a bunch of files, about 90-100 Gb of old system backups, and since I did not want to empty all trash, I deleted the ...
1
vote
2answers
21 views

How to check if a group of files is readable?

I have to check if a group of files is readable. I know how I would go about checking one file by using [ -r file.txt ], but how would I go about writing a loop that would check multiple files ...
-3
votes
3answers
62 views

Delete line from files

I have 8 files in a folder. If any of these files has 2 lines I need to remove the second line from that file. If a file has more than 2 lines then then I do not need to do anything to it. Can anyone ...
1
vote
1answer
56 views

Sticky bit and users with sudo permission

Let's say I chmod 1777 a folder /opt/test and all files inside it as user user1. Hence user2 is able to update and edit files inside the /opt/test directory. When user2 operates via sudo, he's able ...
14
votes
5answers
1k views

How is a directory a “special type of file”?

I am reading this Unix tutorial and came across this quote... We should note here that a directory is merely a special type of file. ...but no explanation or details are provided. How is a ...
1
vote
1answer
13 views

Map Home to External Drive

Whereas I have my OS (in this case, Elementary OS Freya) installed on my non-partitioned internal hard drive, I have an external hard drive with /Documents, /Downloads, /Movies etc. where I store all ...
7
votes
2answers
326 views

How to store a large folder in a single file without compression

Sorry if this is a stupid question, but I want to take a 78gb folder and store it in a single file (for upload into a cloud service), as if I am compressing it in an archive, but I don't want any ...
3
votes
3answers
104 views

Remove passphrase from private key and set specific file mode

If I set a passphrase on my private key like so: openssl rsa -des -in insecure.key -out secure.key and I remove the passphrase like so: openssl rsa -in secure.key -out insecure.key then my ...
1
vote
1answer
18 views

File with a no-atime-updates “A” attribute still updates atime. Why?

$ stat file_1 | tail -n 4 Access: 2015-04-16 21:48:42.675095130 +0200 Modify: 2015-04-16 21:48:42.675095130 +0200 Change: 2015-04-16 21:51:31.844300132 +0200 Birth: - $ lsattr ...
2
votes
1answer
49 views

How to split file and save parts to multiple locations?

How do I split a large file into multiple smaller chunks and write each part of it into separate locations? split command seems to only output all the files into one location. The context I need to ...
-1
votes
1answer
42 views

How to remove duplicate lines from file? [duplicate]

I have file for example 'a' aaa aaa bbb ccc ccc bbb ddd After executing uniq a c i get file 'c' aaa bbb ccc bbb ddd How to delete duplicate bbb lines?
1
vote
1answer
20 views

File corruption using rsync, multiple rsync processes, moved/renamed source file

I'm encountering some file corruption when using rsync (that is, the file contents do not match the source file). I can understand the file becoming corrupt if it is being written to while being ...
4
votes
1answer
43 views

Find the files between two folder dates in linux?

I need to find the folder names along with the file names which has my string in their contents. I am in this directory "/data/queue/data" and I have lot of folders in the same directory and inside ...
1
vote
1answer
20 views

How to undo and revert an accidental `7z e`

I accidentally typed 7z e archive.7z and all the files ended up in my home directory when I wanted to extract them in a subfolder. How can I clean the mess and remove all those files?
3
votes
4answers
491 views

Is is possible to modify a file in a read only directory? [duplicate]

I have already read: Is there a way to modify a file in-place? I am curious if there is a way to modify a file in place using a command that will not create temporary files. Let's say I create a ...
0
votes
1answer
41 views

enable to write to file inspite we remove all file permissions

something isn’t clearly for me when I remove all permissions from file as chmod 000 I expected to get permissions denied when I write to file but still I can write to file as the following example can ...
2
votes
2answers
58 views

Make rsync move (not copy) files on local file system

Can I make rsync to move large amount of files instead of copying them when on local filesystem? I would like it to behave like improved mv command. I know about --remove-source-files option but ...