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

learn more… | top users | synonyms (1)

-1
votes
0answers
10 views

Adding a character to the end of a word

I have a text file that contains the names of students and I want to add to each student his rank attached to his name. Exple: for this file: Alin Robert Elisa Micheal i want to have this result: ...
1
vote
2answers
77 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
18 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
38 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
22 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
55 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
178 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
42 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
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
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
13 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
61 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
37 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
16 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
55 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
53 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
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 ...
7
votes
2answers
324 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
87 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 ...
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
38 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
14 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
38 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
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?
3
votes
4answers
480 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
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 ...
2
votes
3answers
99 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 ...
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 ...
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.
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 ...
3
votes
1answer
199 views

How can I see a file's historical modification times? [duplicate]

stat outputs a file's last modification time. How can I see a list of all the times a file was modified? For example, I'd like to edit a file 5 times, and see 5 modification times.
4
votes
5answers
355 views

Script tries to create files even though it shouldn't have to?

I have a folder which contains some folders, these folder are moved very often so I made a script to see if they exist, and if not then create them. This is what I did to (which I though would) ...
0
votes
1answer
54 views

Delete files older than X days +

I have found the command to delete files older than 5 days in a folder find /path/to/files* -mtime +5 -exec rm {} \; But how do I also do this for subdirectories in that folder?
1
vote
1answer
45 views

How to copy a directory with only specified type of files?

I got a git directory with plenty of python files(and some special file like .git). I'd like to copy only these python files to another directory with the directory structure unchanged. How to do ...
3
votes
3answers
53 views

Traverse, copy & transform file names

My issue: I need to copy log files, all with identical names, but stored 1-deep in subdirectories, and change their names. I'm copying from the a folder called Logfiles which contains a bunch of ...
0
votes
0answers
45 views

Directories and files changed to unknown type [duplicate]

After breaking my Debian jessie system with the mistyped command: # chmod -R 0644 / now I am using a live CD to backup my data but all the files and directories are of unknown type now and ...
-1
votes
1answer
53 views

Generate a tarball or (.tar.gz) of the recently modified files in the directory

As the title says, I need help creating a linux script that generates a tarball or (.tar.gz) of all the files in the directory passed in as an argument to the script and have been modified in the past ...
0
votes
0answers
17 views

Moving Informatica data(directories) from one unix server to another unix server

Can we migrate directories from one unix server to another unix server, without the need of installation of Informatica softwares on the new unix server? If yes, then will there be any change in the ...
0
votes
1answer
30 views

File permissions categories

So I am a little bit confused with File permissions categories. So here is what I do understand and correct me if I am mistaken. For every File , there is an Owner (one user) which have a symbol u ...
1
vote
1answer
35 views

Recursively list files containing an underscore in the file name

I have a large directory with tons of files and subdirectories in it. Is there a way to recursively search through all of these files and subdirectories and print out a list of all files containing an ...
2
votes
1answer
58 views

Using find and sed to copy 20th line of many files into one file

I have a folder called "PKA1" Within this folder I have several folders that look as: 1eV, 2eV .... 30eV Within each of these I have subfolders I have a file called PKA.dump I want to copy the ...
1
vote
1answer
79 views

string search using awk

I have file-1 which has list of transaction id . File -1 201503301616|9b8791b3-f860-409f-aad0-24debf834c1b|10.233.18.29.677220869928387637969 ...
1
vote
1answer
49 views

Tree with directory name and filenames

I run with tree 1.7.0 tree -PF dat It gives . ├── 0deg/ ├── 105deg/ ├── 120deg/ ├── 135deg/ ├── 150deg/ ├── 15deg/ ├── 165deg/ ├── 180deg/ ├── 210deg/ ├── 240deg/ ├── 270deg/ ├── 300deg/ ├── ...
0
votes
1answer
33 views

How to get new created (not change or modified), & removed files in last 24 hours

I want to write one script where I need the below function : List all the files which are created in last 24 hours. If I give the find command with ctime option then it list all files which are ...
-1
votes
1answer
13 views

how to disable folders/files under root folder in RHEL?

I want to "disable" listing of folders and files under root folder in RHEL. So when I login to my application nothing should be visible in root folder.
5
votes
1answer
142 views

Is it possible to create a non-empty file without write_close and rename event?

The reason why I am asking is because I'm using iwatch (not to confuse with a gadget device) to watch for filesystem events (in my case - file creation/renaming). What I cannot explain is this log: ...