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

learn more… | top users | synonyms (1)

1
vote
2answers
73 views

Random files selector in filesystem

Context : In order to test some backup process which are supposed to work all nights, i want to select a random files on a large amount of datas. (Around 7 millions of files. This is a NFS server with ...
1
vote
3answers
38 views

Linux Mint 17.2 suddenly loses write access to filesystem

It may be a hardware problem since I'm using new computer but I'll ask anyway. So it happens sometimes - system becomes unable to write anything on hdd, applications start to crash, I forced to ...
1
vote
0answers
30 views

Empty output file in systemd unit file

I created the below systemd unit file (Centos 7) to run KMS server and logs the client requests to the kms-server.txt file. The service runs without any problem and responses to the client's requests ...
1
vote
1answer
76 views

Saving process output to a file in systemd unit file

I created a systemd file unit (Centos 7) and I wanted to save the Python output to a file but the service won't start with the below code. [root@static ~]# cat /etc/systemd/system/pykms.service ...
2
votes
2answers
53 views

Extract a List of .zip files into one new directory each, directory name to be taken from name of the zip file

I have a folder containing many .zip files. They are named like this: John-Rupert A. Doe_nnnnnnn_assignsubmission_file_*.zip where n is a digit, * is a string and John-Rupert A. Doe is a string ...
1
vote
3answers
49 views

Rename files in directory based on names of files on another directory

I'm not sure if this has been asked here but here is my problem. I have files in lets say dir1 named: File 1.mp4 File 2.mp4 etc.. Now on directory dir2, I have files named: Sub 1.srt Sub 2.srt ...
0
votes
1answer
38 views

Is ctime on linux always greater or equal as mtime?

I'm trying to clear out how the timestamps of a file on linux work. In this answer is stated: Modify - the last time the file was modified (content has been modified) Change - the last time ...
1
vote
1answer
145 views

ls: No such file or directory error

I am writing a very basic shell for my school. Even thought commands like "pwd" or "date" works when i try "ls" it shows me that "ls: No such file or directory error" The code of my shell is ...
0
votes
1answer
26 views

Password protected script on editing, no password on executing

Is there any way to set a password on a script (or any file for that matters), without having to enter a specific command line to decrypt it each time I want to edit it? Setting this password to a ...
1
vote
1answer
76 views

Aircrack-ng: No /pentest/passwords/wordlists/darkc0de directories

this is my fist question on this forum. I'm currently using Linux Mint 17.2 Cinnamon and trying to run Aircrack-ng to show the password of my own Wi-Fi connection, I got the Handshake too. The problem ...
2
votes
2answers
60 views

Add Filename as first line of file in shell script

Hello and thanks in advance. I need to take a file, insert the filename as the first line of the file, then move to a different name. Here's the wrinkle. I need to grab the oldest file in the ...
0
votes
1answer
50 views

How do I do a long listing of files and only show those that are a certain size?

I need to show a long listing of files in a directory but only those that are a certain size in bytes. Can someone tell me how to do this?
0
votes
1answer
22 views

Append one file to two files in unix script [duplicate]

I need to append one trail record to both the files. cat file1 >> file2 this appends everything in file1 to file2 My requirement is to append to file1 content to both file2 and file3.
1
vote
1answer
46 views

Running command on multiple files within multiple directories

I want to run the command python quast.py -o quast contigs.fasta but I want to do this for multiple contigs.fasta files in multiple directories. I'm running OSX.
2
votes
2answers
77 views

Move file/table by averaging a column

I have the following program that allows me to move a file (actually a table) if the value of the first line of the fourth column is the highest one (in comparison with 8 other files having the same ...
1
vote
3answers
123 views

Change name of directories and included file

In a directory I have several sub-directories named as follow (the [1-9] means going from 1 to 9): AA_BB_CC_river[1-9] Each sub-directories contains a file (ascii) having exactly the same name as ...
-1
votes
1answer
56 views

Looping through files in directories, each matching a pattern [closed]

I want to loop over files matching *.pdf, in the directories matching [A-J]*? I don't understand what is unclear about this question that resulted in putting it on hold.
4
votes
2answers
130 views

Test for existence of multiple files, given by pipe

I have a command that gives me a list of files, one on each line. Filenames are "normal" - no spaces, no need to escape parentheses etc. Now I want to pipe that command to something like test -f and ...
2
votes
5answers
81 views

Looping through a file using a column

I am trying to loop through a file named file.txt that contains a bunch of junk and one column (column #4) I am interested in. I want this loop to run from 0 to eof. For each value in column 4, I want ...
3
votes
2answers
65 views

How to keep exactly one file in a directory?

I have recovered files and currently they have this structure: root/MD5_of_file1/file1 root/MD5_of_file2/file2 ... root/MD5_of_filen/filen Obviously, duplicates are now in the same folder. The ...
3
votes
3answers
105 views

Find and replace with contents of a file

I have a file that begins with a few "include" statements, like this: include foo.xyz include bar.xyz do c do d Suppose the file foo.xyz contains do a and the file bar.xyz contains do b. How can I ...
5
votes
1answer
82 views

How to find the most frequent word of each file in a directory?

I need to find the most frequent word of each file in a directory and print it like this : 12 my /home/test/file1.txt 5 you /home/test/file3.txt 7 hello /home/test/file4.txt I tried: for tmp in ...
2
votes
2answers
116 views

File merging - same name, different extension

How would you merge different input .txt and .tsv files (within a directory) who have the same name but a different extension into an output file? Input: file1.txt, file2.txt, file1.tsv, file2.tsv ...
1
vote
1answer
20 views

Making a fasta file from 2 different files

I have 2 files file1.seq and file2.seq. They look like these: file1.seq ACGGTGTGATG file2.seq CGTGATGATGT I want to make one fasta file which would be like: >file1.seq ACGGTGTGATG ...
3
votes
3answers
263 views

sudoer file how to give a particular user full access to only certain file

I want to give a user full access to only certain files, can someone show me how to do that? For example, I want to modify the sudoer file to grant user access to only certain file. Thanks.
1
vote
1answer
80 views

Force nautilus desktop to open files with another file manager

I'm using Elementary OS Freya (which is based on Ubuntu), with nautilus to manage the desktop. Is there a way to force nautilus desktop icons to open files with another file manager (PCManFM in this ...
0
votes
0answers
19 views

Where does KVM hypervisor store VM files?

For a guest machine how can I know where the files created in vm (not the VM config files but actual files which I create while using VM) are stored on my host machine? To which directory of my host ...
2
votes
1answer
28 views

How to reuse file pattern in .gitignore in bash/zsh?

Here is the content of the .gitignore cron.yaml build target webview *.pyc *.sublime-workspace .idea *.rej .coverage app/tools/temp_*.py app/tools/*/temp_*.py I am currently iteraring files in a ...
1
vote
1answer
61 views

Compare 2 Columns in 2 different files

I need to subtract second and third columns between 2 files based on the first column and do not show rows with diff_column_2(DIFF-IO)=diff_column_3(DIFF-SELECT)=0. Noting that the order can be random ...
2
votes
1answer
30 views

ACL group permission still not allowing write permissions

There's a file called '/etc/file.conf' on my filesystem. $ getfacl /etc/file.conf getfacl: Removing leading '/' from absolute path names # file: etc/file.conf # owner: root # group: root user::rw- ...
82
votes
6answers
6k views

How are “/dev” Linux files created?

There are special files in Linux that are not really files... The most notable and clear examples of these are in the dev folder, "files" like: /dev/null - Ignores anything you write to the file ...
1
vote
1answer
30 views

Extract entries from a file ranging from one date to another

There is a file which has entries with the first and second field as date and time in the following manner : 2015/10/14 00:33:37. The file has 100,000+ lines and is constantly updated. Entries in the ...
3
votes
4answers
92 views

Moving a list of files by matching them to a destination index

Say I have two text files src.txt and dest.txt, where src.txt contains a list of filenames (some of which include spaces) in /src/dir/ and dest.txt contains, in random order, a list of the complete ...
3
votes
2answers
59 views

How can I list all files, but only in directories that have no subdirectories?

I have a directory tree that I want to search recursively for all files of a certain type (for example all .jpg's), but I only want to list these files if they are at the bottom of a directory tree. ...
4
votes
4answers
150 views

Delete all but the most recent n file for each group of files that share the same prefix in a directory

My question is a bit different from some older questions simply asking for "deleting all but the most recent n files in a directory". I have a directory that contains different 'groups' of files ...
1
vote
3answers
68 views

Printing a line at a specified offset in a file

I have a file with 50 characters on each line and 50 lines. Each line of the file contains arbitrary letters. I want to specify a character sequence number (ex: 52) and have the appropriate line of ...
1
vote
4answers
95 views

Find and delete all same files (by name) between 2 directories

I want to find all files in dir1 having corresponding same file names in dir2, and delete them from dir1. For example: dir1: first.txt second.txt dir2: third.txt first.txt So I want to remove from ...
2
votes
2answers
50 views

Find and replace all same files between 2 directories

I want to find all files in dir1 having corresponding same file names in dir2, and replace them with the files from dir2. For example: dir1: first.txt second.txt dir2: third.txt first.txt So I ...
1
vote
1answer
23 views

Group Directory permission

you have been asked by couple of programmers to make ProjectA a group directory on a UNIX server which allows them to create files under that directory to facilitate collaborative work, but only the ...
1
vote
1answer
106 views

md5sum for every file (with ll)

I want output like this: name size and hash: myfile.txt 222M 24f4ce42e0bc39ddf7b7e879a mynewfile.txt 353M a274613df45a94c3c67fe646 For name and size only I have ll -h | awk '{print ...
2
votes
0answers
40 views

Unable to insert records on sqlite on a Linux environment

I tested a simple Php program using Sqlite3 instead of mySQL on my own computer and it works fine. What the program does is simple insert of record into a certain table. Now, when I try to do that on ...
1
vote
1answer
65 views

How to grep several files using part of filename as a pattern?

I have a folder which includes several files named order[ID].log where [ID] is a string e.g. orderID1.log orderID2.log orderID3.log orderID4.log ... I need to write a script in Linux to grep each ...
3
votes
3answers
434 views

Delete all files in a folder except the last (most recent) 20 [duplicate]

I want to remove all the files from different directories, and want to keep only latest files 20 files. is this the correct command to do this? ls -t1 /mnt/dwh/ftp/dwh_ftp_cbs/ARLOGS/ | tail -n +22 | ...
1
vote
4answers
125 views

Changing column of multiple csv files

I have a csv file called scenario1.csv in which the second column has column names like "0-4 years high risk", "65+ years first responder" etc. There are 20 such values. The 21st row, 2nd column has ...
2
votes
1answer
54 views

How to make files unmodifiable and undeletable without `chattr`?

I (and my collaborators) have a directory tree containing ~160K files (most of them are automatically generated by data gathering instrumentation). These files reside in a system that gets backed up ...
2
votes
1answer
26 views

combining output from different scripts into different files in a loop

First of all: I hope the question is comprehensible, otherwise please let me know and I will do my best to make it more clear. This is a follow up to Replace one entire column in one file with a ...
-1
votes
1answer
151 views

Linux folder size limit

We are using below code to create folder in Linux server. File dir = new File(filePath); if(!dir.isDirectory()) dir.mkdirs(); After that creating files inside that ...
2
votes
0answers
26 views

How to set EMIRGE program to write files with desired permission

How can I get the EMIRGE program to read certain files? I am using Linux Mint (17.1). I have downloaded a program call EMIRGE, which is supposed to take fastq files (a text file format for ...
0
votes
2answers
25 views

Search for a non exact match and return column 1 of that file

I have a tab seperated file which looks like this: Adam Group1,Group2,Group8,Group9,Group10 James Group1,Group11,Group12,Group7 Kelly Group18 Alfred Group1,Group8,Group10 Manuel ...
2
votes
3answers
50 views

Recursively delete files with 'WIDTHxLENGTH' in the name in a directory

I have a directory that has subdirectories, and I want to delete images named like thumbnail-name_WIDTHxLENGTH.{jpg,png}, where WIDTH and LENGTH are both decimal integers, like box-image-150x150.jpg ...