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

learn more… | top users | synonyms (1)

1
vote
2answers
39 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 ...
7
votes
2answers
977 views

How to make a temporary file in RAM?

I have a script that will pipe its output to |tee scriptnameYYMMDD.txt. After each cycle of the for loop in which the output is generated, I'll be reversing the file contents with tac ...
2
votes
4answers
4k views

Count files in a directory by extension

For the purpose of testing, I'd like count how many images files are inside a directory, separating each image file type by file extension (jpg="yes". This because later it will be useful for another ...
0
votes
1answer
12 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
41 views

Adding a character to the end of a word [on hold]

I have a text file and I want to add a character attached to each word of the file.
1
vote
2answers
101 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
20 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
2answers
28 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 ...
1
vote
1answer
43 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
1answer
348 views

Apache created files and its permissions for CentOS 6.x

In short, I have an authenticated HTTP-POST that: posts a jpg image (created as 666 apache:www) into /directory1 (777 ftpuser:www) creates /directory2 (created as 666 apache:www) in a 777 ...
2
votes
1answer
60 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 ...
2
votes
1answer
30 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
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 ...
6
votes
1answer
193 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?
1
vote
1answer
9 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 ...
3
votes
2answers
62 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 ...
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
36 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
14 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 ...
24
votes
5answers
48k views

How to list all files in the size order

I would like to list all files in the order of big to small in size and the files could be present anywhere in a certain folder.
4
votes
4answers
930 views

Using GNU Parallel With Split

I'm loading a pretty gigantic file to a postgresql database. To do this I first use split in the file to get smaller files (30Gb each) and then I load each smaller file to the database using GNU ...
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
40 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
17 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 ...
1
vote
1answer
54 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 ...
-3
votes
3answers
57 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 ...
7
votes
2answers
325 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 ...
51
votes
5answers
38k views

What is a Superblock, Inode, Dentry and a File?

From the article Anatomy of Linux File Systems by Tim Jones, I read that Linux views all the file systems from the perspective of a common set of objects and these objects are superblock, inode, ...
10
votes
4answers
3k views

Can I make `cut` change a file in place?

The man page doesn't give me much hope, but I'm hoping it's an undocumented (and/or GNU-specific) feature.
0
votes
2answers
340 views

How to move completed torrent downloads to another folder without breaking the torrent link?

I'm using Transmission on EOs and I've downloaded a bunch of torrent files which ended up my Download folder in my /home. I'd like now to move the files to my external hard drive without breaking the ...
3
votes
3answers
92 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
17 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 ...
4
votes
1answer
40 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 ...
18
votes
4answers
22k views

How can I find out how many lines a text file contains without viewing it?

How can I find how many lines a text file contains without opening the file in an editor or a viewer application? Is there a handy Unix console command to see the number?
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
40 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?
21
votes
1answer
28k views

How can I increase the number of inodes in an ext4 filesystem?

I had a problem (new to me) last week. I have a ext4 (Fedora 15) filesystem. The application that runs on the server suddenly stopped. I couldn't find the problem at first look. df showed 50% ...
3
votes
4answers
481 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 ...
1
vote
1answer
15 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 ...
1
vote
1answer
19 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?
0
votes
1answer
60 views

Is there a way to use sed or awk to filter data inside a zipped file? [duplicate]

Is there a way to use sed or awk to filter data inside a zipped file? When I run a sed or awk command and send to stdout the file created is 0 bytes.
3
votes
4answers
3k 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) ...
2
votes
2answers
44 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 ...
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
3answers
102 views

remove all instances of _000 from multiple files

Had to recover my music library from a HDD which died.... got everything I wanted but all music track names have _000 added at the end. I really don't fancy going through 8000 individual music tracks ...
18
votes
3answers
2k views

How does touch -t work internally?

How does touch -t command works exactly, internally (I tried to find its source code but couldn't)?
0
votes
0answers
29 views

Tar corrupting file attributes and skipping directories

While creating tar archives for backup purposes with 'large' numbers of files (200+), I have been repeatedly running into the following errors: tar: some/path/file.xyz: Cannot stat: Invalid argument ...
16
votes
8answers
35k 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 . ...
0
votes
2answers
39 views

How can I quickly find the 20 most recently modified files on Mac OS X (instead of using Python)?

Of course it's possible to take the output of find . -type f | xargs ls -l and pipe it to a Python script that would sort the lines and output the top 20. But is there anything faster than that?
0
votes
3answers
49 views

copy the contents of a variable in a text file

I know this is a stupid question but I want to know how I can put the contents of a variable in a text file. This variable is a string that I want the code with the base64 command.But this command ...