Questions tagged [files]

Manipulating files: copying, renaming, searching, analyzing, archiving, etc. For operating on text in a file, see /text-processing. For questions about the Files file manager (formerly Nautilus), see /nautilus.

Filter by
Sorted by
Tagged with
2
votes
1answer
24 views

Merge two binary image files by boolean OR (ddrescue output filename mistake)

I made a silly mistake by using the wrong output filename when resuming a ddrescue. This is what happened: ddrescue -b 2048 -d -v /dev/sr1 IDTa.img IDTa.ddrescue.log Then the computer crashed and I ...
0
votes
1answer
61 views

The 2nd 'if' in the code doesn't seem to work [closed]

On macOS BigSur v11.3.1, the following code is in a .command file which when opened (double click) runs in the .zsh shell in terminal. The code below is trying to move the duplicate files from the ...
0
votes
1answer
22 views

after installing a new distribution I don't have access to my previous Home partion files

after installing a new distribution I don't have access to my previous /home partition files but about 121 GB of volume is full also If I try live mode I can see them. I tried:ls -la in /home ...
1
vote
2answers
22 views

rsync files across multiple user accounts

I am quite new to using rsync and I'm wondering if it is possible to rsync files across multiple user accounts on a single PC? For the computers I want to apply the rsync command to, each user has to ...
0
votes
1answer
12 views

How to compile lines with a certain word in the last column into a separate file?

I have a csv file and I need to filter it out into two files based on whether the last column contains the word "ecDNA". I already have two more copies of the file to edit without changing ...
0
votes
2answers
60 views

What does mounting do in Linux and why do files appear in both /dev and /media after mounting?

I'm pretty new to Linux and I've been trying to understand how the file system works but I just can't seem to get what mounting is. I've seen several other questions on this site explaining but they ...
2
votes
2answers
30 views

In a file to find and replace/change multiple strings in a line with shell script

I am new to shell scripting What I have is a log file, each line begins like the below entry, [2021.04.27.17:03:43.813]: ERROR - [2021.04.27.17:04:36.790]: SUCCESS - The desired output to a new file ...
0
votes
2answers
86 views

Can not change the user owner of a file

I'm running Ubuntu under Windows. I have a file which is owned by a user named leon: -rwxrwxrwx 1 leon leon 0 Jun 8 20:25 linux1.txt but for some reason, I can't change its owner by running (...
2
votes
0answers
25 views

Tool for clearing build directories (different programming languages/frameworks)

Aside from writing own scripts, is there some kind of CLI tool that can scan target folders or volumes and delete build artifacts or recreatable dependencies with support for different programming ...
0
votes
2answers
79 views

How to limit the number of files in a directory?

Is it even possible to limit the number (and not the size) of files in a specific directory? My directory only can contain up to five files, and cp file_6 mydir must not be allowed.
0
votes
2answers
56 views

bash: Read from stdin until a string delimiter

Let's say I have two files containing arbitrary bytes: ./delimiter and ./data. I want to read from ./data up to and excluding the first occurrence of the byte sequence in ./delimiter. How would I do ...
3
votes
2answers
94 views

Parent child directory same name , move files to parent directory

I need a way to search directories for child directories with the same name and then move all files in the child directory to the parent. Thus from /recup-dir1/recup-dir1/files to /recup-dir1/files. ...
2
votes
1answer
24 views

How can I move files to different directories depending on their contents?

I have many files which contain a string like this: /databis/defontis/Dossier_fasta_chrm_avec_piler/SRR6237661_chrm.fasta: N putative CRISPR arrays found Where the N is a number that can be either 0 ...
2
votes
1answer
27 views

Reading stale file data with debugfs cat

I'm trying to read the contents of a file using the file's inode. This works fine: echo "First line" > data.txt sync sudo debugfs -R "cat <$(stat -c %i data.txt)>" /dev/...
4
votes
1answer
40 views

Bad byte count while using hexdump

I am trying to display a binary file with records consisting of: 8 bytes unsigned int 4 bytes unsigned int 4 bytes unsigned int 4 bytes unsigned int 4 bytes unsigned int I try to display it using ...
6
votes
4answers
1k views

In Linux, is there a system layer/script that handles the opening of files?

in Linux, is there a layer/script that handles program-requests to open files? Like when you open a file-descriptor in bash: exec 3 <>/documents/foo.txtor your text-editor opens /documents/foo....
1
vote
1answer
92 views

How does the OS access files stored on the hard disk?

I know the first thing the OS accesses on the harddisk is the superblock. But then what?
0
votes
2answers
24 views

File listing in SFTP doesn't synchronise

I have a SFTP account that I use to store files. It works fine, but when I am using lftp on connection A to look at the files, and connection B to store files, connection A does not reflect any ...
1
vote
2answers
46 views

How to create a temporary file that has “normal” permissions?

In a build script I want to create a temporary file that has a unique generated name, then write some data to it, and then rename that file to its final name (the reason for this procedure is that I ...
0
votes
1answer
39 views

Why isn't tail command tracking the changes in a file in realtime? [duplicate]

When I track a file in realtime using descriptor i.e tail --follow=descriptor file_name, it doesn't show the changes made in the file, whereas if i track the file in realtime using name i.e tail --...
0
votes
1answer
72 views

How do I copy a file to the clipboard with the terminal?

I'm aware of how to copy the contents of file: xsel -b < myfile.txt But this is not what I want. I would like something like this: ./file2clip.sh myfile.txt Which would copy myfile.txt to the ...
0
votes
2answers
38 views

How should btime be specified?

I have read that Unix systems has not specified btime or generally like POSIX, there is no specification about btime. There is a mention about btime. Therefore the question, how should btime be ...
0
votes
2answers
62 views

If files are copied from a first volume to a second volume, will the files stay the same?

When I connect the external hard drives to my computer(with FreeBSD or other Unix systems) and copy files from the first external hard drive to the second hard drive, are the files on the second hard ...
1
vote
0answers
38 views

Is there any tool in linux that can monitor two folders in real time?

Is there any tool in linux that can monitor two folders and have the contents of folder a synced to folder b in real time?
0
votes
2answers
49 views

Reshaping tab separated file

I have a file that looks like this: Time Flag 0.65 5.885581e-01 0.56 5.847484e-01 0.58 5.278409e-01 0.57 1.140746e+00 1.00 0 0.00 0 1.00 1 0.00 0 But this is because I ...
0
votes
2answers
36 views

Compare the times of different files using shell script

I have a file with below contents. Here i need to compare the timestamp of HIW.ear in the first line with the timestamp of .jars from the second line and i am running out of ideas on how to do this. ...
0
votes
2answers
41 views

Compare content of two folders/disks (including timestamps,permissions)

I have two directories on two different hard drives and want to check if the content is really exactly the same. From what I read I can use diff -rq dir1 dir2 to check if files are missing or differ. ...
1
vote
3answers
55 views

Sorting and copying files

I am newbie here, please be patient. I have a directory containing thousands of files. Filename always start with 1 or 2 letter and have 4 character before underscore "_". The number of ...
1
vote
2answers
26 views

How do I output the unique lines from a grep pattern match while ignoring other parts of the line?

Suppose I have a file called names.txt, which contains a list of names and corresponding emails of people in the following format: FName1 LName1 <random1@test.com> FName2 LName2 <random2@...
3
votes
1answer
147 views

How to make `du` only include regular files in its output?

I want to list all files in descending order based on disk usage, and have obtained the following commands from this: To list the top 10 largest files from the current directory: du . | sort -nr | ...
0
votes
0answers
17 views

Graphic file copier with filter

I'm looking for a FOSS graphic file copier that has a filter function, like coping a dir tree removing certain files/dirs. I'm aware of only one actively developed graphic tool for coping files (...
0
votes
3answers
29 views

Numbering a bunch of files according to the date modified timestamp?

So I downloaded a bunch of documents in chronological order, but I have to copy and edit them, which would change the date modified. I would like to prefix them with a number (001_, 002_...) in the ...
3
votes
1answer
40 views

How to copy a file into another file at a certain position using the command dd?

I want to copy a file of 256 bytes at a certain position into another file of size 2048 bytes containing random data, with the command dd in Linux. The offset I have is 144. I have assumed that bs=1, ...
1
vote
1answer
63 views

Compare first column of a file with value if matched get the record

Can any one help me with the below scenario? I have a reference file has data below: file_id|file_name 1|file1.txt 2|file2.txt 3|file3.txt I have a script which accepts input as file_id and fetches ...
2
votes
2answers
196 views

How is the theoretical maximum file size on filesystems like XFS calculcated?

Documentation for XFS claims its current theoretical maximum file size is 8 exbibytes - 1 byte. However, I am wondering how this calculation was computed? I cannot seem to find discussion of this ...
0
votes
1answer
47 views

mktemp creates file in pwd rather than in /tmp

Previously mktemp used to create files in /tmp. Today I noticed that mktemp is creating file in $PWD rather than in /tmp? Did I change something inadvertently? Any suggestions to fix this? Note: I ...
2
votes
2answers
22 views

How to sync between 2 file descriptors to the same file, one for reading one for writing

I have the following code: FILE *file = fopen("testfile.txt", "r+"); int fdfile = open("testfile.txt", O_RDONLY | O_SYNC); const char word[] = "writing to a file ...
0
votes
1answer
26 views

can't stat a file with newline in name

I have a file with the following name (I didn't name it!): 'A MULTI BAND MINI PRINTED OMNI DIRECTIONAL'$'\n''ANTENNA WITH V-SHAPED FOR RFID APPLICATIONS.pdf' Weirdness is caused by the '$'\n' in the ...
0
votes
0answers
91 views

Moving sparse files

cp not only auto-detects sparse files but also has --sparse=always option. I wonder if mv works with the same mechanism or the safe way for moving sparse files is cp && rm Or is there any ...
0
votes
2answers
37 views

Search one file to see if it contains information from another file

I have two files. The first is unip.txt and the second is ipex.txt and each file contains IP addresses. unip.txt: 49.235.113.205 50.115.166.136 51.15.70.104 51.15.87.74 51.15.134.103 146.148.13.9 148....
0
votes
1answer
24 views

Unix File Protection Commands

~/UnixCourse You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls to see what files are ...
0
votes
0answers
13 views

Yet another question about recovering lost files (mv, photorec)

Someone that I asked to transfer files for me, transferred some files using mv and something happened. They don't exactly know what, all I know is that the usb stick became full during the operation ...
0
votes
1answer
42 views

Generate a CSV from select files' directory information

I'm on a mac, and I'm afraid this command line problem has me stumped. At least I'm assuming the easiest way to do this would be through the CL. I'd like to recursively search a directory tree for ...
1
vote
1answer
52 views

Finding text file's encoding

The iconv command may change file encodings. But is there a command to find the file encoding of a certain text file. Also, I am trying to find what file encoding standards each country use. So that I ...
0
votes
1answer
31 views

Uploading files to remote server and batch rename

I have a large set of files and need to upload them to a remote machine with specific destinations. I have a map (can be re-organised) as 1/1/1/file.jpg -> 2/3/4/image1.jpg 2/12/2/file.jpg -> 5/...
1
vote
2answers
51 views

using rsync (or other tool) to correct file time stamps between two systems

I have two systems (A, B) which have the same file structure. Files are identical but in one of the places (B), the file timestamps are incorrect. The problem is that most of the timestamps in B are ...
1
vote
1answer
47 views

Editing a file without it being executable

I have a file secretinfo.txt inside a directory SensitiveData that I am trying to edit. Currently, the directory and file have the following permissions: drwx------ 2 www-data root 4096 Apr 20 17:39 ...
1
vote
1answer
43 views

Bash script to copy files and then move to trash (non-destructive)

I am trying to write a bash script to copy files with cp or, preferably, rsync and then move the source files to the trash. I do not want to use mv because in case of an error, I want to be able to ...
0
votes
2answers
31 views

select data conversion based on value range

I have a text file with 3 columns of data. However at random times in the various files there is a change in the in the observed unit from ppn to ppb resulting in the need of a conversion factor and ...
0
votes
0answers
17 views

Delete files of specfic type between two dates

We are trying to write some code in PeopleSoft to delete certain files in a remote server of a type between certain dates where all are specified by a PeopleSoft page. User enters a path, file type ...

1
2 3 4 5
90