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
-1
votes
1answer
31 views

Delete files with specific content

Having a thousand of data files (same extension) in a directory, how to delete those which contain a specific parameter statement? For example, if I wented to delete all files containing the line Key =...
1
vote
3answers
73 views

How to generate multiple tar.gz file by overriding specific files for each environment?

I have a root folder Products and then bunch of sub-folders inside it. Each of those sub-folder has bunch of files as of now. Just for simplicity I came up with sub-folders name as folder{number} and ...
3
votes
0answers
19 views

Files lost by encfs

I would like to ask you for a help. I recently used the software encfs in my ubuntu 18.04 laptop. I created a new stash using the same software in my desktop. I would like to list the steps.... I ...
3
votes
0answers
33 views

Is it possible to disable unnecessary disk writes to mmap files on linux?

I would like to know if there is a way to prevent Linux from periodically syncing mmap'd files to disk, while still allowing the OS to write back when physical memory gets tight. I am writing ...
0
votes
0answers
14 views

extracting files using rsync

I am working on pf-sense and its integrated with suricata, when alerts are generated it stores the file into directory containing multiple sub-directories. I want to extract all the files from these ...
2
votes
1answer
31 views

How to stop truncate command safely

I am trying to empty my syslog.1 file which was flooded with some messages and has the size of 77 GB. I did sudo truncate -s 0 /var/log/syslog.1 but the command is taking more than 2 hours to return. ...
1
vote
1answer
59 views

Rsync source list to destination list

Edit: to give more insight into what I'm trying to achieve, I'll give the example below (there was poor folder structure on part of the team and we aim to fix it): Source: /ShopA/Finances/Costs/...
0
votes
0answers
19 views

Automatically running a script on a file as it is created via SAMBA

I have a Linux machine acting as a local SAMBA file server. Most of the clients are Windows. The server is only accessible from within my intranet, and it only serves photos (jpg, gif, png, etc). What ...
1
vote
1answer
19 views

Ramdisk mounted at mnt/ramdisk goes to /run/user

To create a ramdisk (Ubuntu 18.04), I issued "sudo mkdir /mnt/ramdisk" at the Putty terminal prompt. Then I issued "mount | tail -n 1" and it returned: tmpfs on /run/user/1000 ...
0
votes
1answer
16 views

Tar multiple files in a custom way?

I faced a problem of building a tarball for my application manually to prepare a distribution. My project structure looks as project_root | |__resources | |____config.conf | ...
2
votes
1answer
54 views

Group files that share same header then concatenate them

I'm using Bash on Ubuntu and my issue is the following: I have dozens of .TXT files in a certain folder. As far as I know, all of them have a header (I believe every header holds on 1 line but not 100%...
1
vote
0answers
25 views

How to ID images that have extra data attached?

I'm trying to extract images from a complex file. I'm able to break down that file in different sections and extract them all to different files. The idea then was to use file to detect the type of ...
-1
votes
0answers
27 views

How I can check if the a certain file is present in a directory?

I have a lot of directory with a regular name ????_?. I would like to enter in each directory and generate a TXT file (for each directory) containing a name of specific file (containing the string &...
4
votes
3answers
425 views

Files names with an ' (apostrophe) inside of them

When I list files that have spaces in their names, most of the time I see them surrounded by apostrophes : 'famille, vacances, loisirs' I had to edit a file whose name had to be : Chapitre 2 : L'accès ...
0
votes
1answer
29 views

How do I remove any and all characters before the first period in a file name?

I have 1366 files whose file names start with up to four numbers. For example: 128.unique filename.flac 6.unique filename.flac 1288.unique filename.flac I want to remove all numbers and the period, ...
0
votes
1answer
47 views

How to delete files using grep?

Here the result of this command : sudo dpkg -l | grep mariadb It returns me this : ic mariadb-server-10.3 1:10.3.23+maria~bionic amd64 MariaDB ...
0
votes
1answer
21 views

Meaning of the extension .ucode of files in /lib/firmware

I was examining my firmwares and I found files of various extensions: .ucode .bin .fw .brd .sbcf etc. I searched for .ucode bit got few results whcih talked about missing drivers etc, but did not tell ...
0
votes
1answer
53 views

Zsh: How to create a directory and file inside it with one command?

I am curious whether it is possible to create a directory and file inside this directory with one command, similar to mkdir -p but for a text file and intermediate directory. I read through the touch ...
2
votes
2answers
57 views

How do I delete all directories with a certain file type in them?

I'm writing a command line script to 'unpack' folders with .svg files from downloads. I've copied the required files to a specific directory and now I need to delete all the directories with .svg ...
5
votes
3answers
77 views

What are systemd runtime unit files for?

The documentation I have read on systemd unit files states that unit files can be found in three locations on the filesystem: /etc/systemd/system/: system unit files /run/systemd/system/: runtime ...
0
votes
2answers
36 views

Compare multiple file suffixes containing date & time and do action on most recent

I have multiple files in a directory that follow the below pattern. logA.log.$todayDate.$timeCreatedlogA.log.07222020.084355 I want to compare the $timeCreated part of all the files in the directory ...
3
votes
0answers
81 views

find command “finds” file I'm looking for but it doesn't exist

I am searching for a particular file so I use the find command and it finds the file that I'm looking for: $ find / -name connect_power.aif 2>&1 | grep -v "Operation not permitted\|...
0
votes
2answers
57 views

Ext4 and Linux - very large number of files in one directory - operations

I have a problem with a very large number of files in one directory. The file system is ext4. I reached the 2**32 file limit and couldn't even write any file on this partition. The problem is very big....
2
votes
0answers
35 views

Getting moved files to inherit permissions in Linux

I have set up a folder that is assigned to a group. drwxrws---+ 2 operator IDGroup 4096 Jul 21 10:22 MyTest The following ACL is applied: setfacl -Rdm group:IDGroup:rw MyTest Files created ...
1
vote
0answers
37 views

why does my grep search not find any matches when i loop through the pattern, but does when i write it in manualy? [duplicate]

I am trying to list the number of occurrences of lines that contain a certain word within a file. The words I am looking for are stored in a separate file that I'm looping through with this code: cat ...
0
votes
0answers
20 views

Empty dir not deletable because not empty + undeletable strange files

After uninstalling Apache Netbeans 11.1 I discovered that the directory ~/.netbeans/11.1/ was still there. This is it's contents: $ tree ~/.netbeans/11.1/ . ├── config │   └── Windows2Local │   └──...
1
vote
0answers
29 views

Replace file with my own version when an external program changes it

I was wondering if anyone knew how to replace a file with my own version when an external program changes it. My system is running on ubuntu 20.04 Thanks in advance! Edit for clarity: when Minecraft ...
0
votes
0answers
10 views

Monitor log files and alert when changed but not when content is added

How can it be technically achieved to monitor log files and alert when the file has been deleted and the contents have been changed, but not in the case bytes were added? Ideally this solution should ...
3
votes
2answers
93 views

Remove duplicate lines from files recursively in place but leave one - make lines unique across files

I have many folders and folders contain files. The same line might appear multiple times in single file and/or in multiple files. Files are not sorted. So there are some lines duplicated across ...
1
vote
0answers
43 views

Cannot find any way to search for files containing 100% NULLs? [migrated]

Thanks in advance for even reading this.. ;-) I lost my Desktop folder(I had a lot of stuff there.. maybe 1000 files). And used a tool to recover the deleted files right away. If found all the ...
23
votes
5answers
3k views

Is there a way to tell which device a file is located on?

If I have a file /abc/def/ghi/jkl, is there a way to tell which device it is located on, or should I parse /etc/mtab and see what matches /abc/def/ghi/jkl better?
0
votes
0answers
22 views

Dynamic file access control

I have a shared folder that different program use. I would like to be able for "file events" in this folder, like file creation, access for read or write. The idea is to hang the open of the ...
0
votes
3answers
54 views

How to limit grep to scan only the first 10 lines?

I got a command foo that output a list of files separated by \n line. I am using the below command to filter the results by regex content of the files. foo | xargs grep -l regex The problem is that ...
2
votes
2answers
58 views

Filter a list of files by content

I got a command foo that outputs a list of files separated by a new line. How can I filter those files by their content using regex, and output the filtered files list?
1
vote
2answers
34 views

How to clear the content of a file which is locked by a running process?

I am running JMeter on an Ubuntu machine. And running a 12 hour test.  During this I am observing the log file is increasing to a very big size (around 18 GB). Is there any way I can use inside a cron ...
0
votes
1answer
76 views

cannot touch file: No such file or directory for a specific file

I know you have had many other doubts related to this same issue, but I have not found anything that would allow me to reproduce the same case that I had. The situation is simple, I can do this: $ ...
1
vote
1answer
33 views

Perform action based on directory's existence

I'm writing a shell script in Jenkins pipeline, where if a specific zip file is available, then proceed with further step. If the zip file does not exist (it may be case that directory structure ...
0
votes
1answer
29 views

boot.log does not get filled with boot info after re-creating the file, why?

Running Linux Mint 19.3 Cinnamon. I intentionally deleted the boot log file: /var/log/boot.log And re-created it with touch, just changed permissions afterwards, to have it empty: ll /var/log/boot....
0
votes
1answer
41 views

How can I remove source code based file types in linux?

I have a list of raw files that were scraped and it consists of both text and source codes. Below is the filetypes listed and I wanted to remove all files which are of type C Source, python script, ...
0
votes
1answer
28 views

Is it possible to write a script that appends a “#” to any line of a file that begins with a capital letter?

In order to make a school project easier, I want to append a delimiter to each line beginning with a capital letter with a bash script. Could anyone help me out? I've tried reading the file line-by-...
2
votes
2answers
73 views

How to split text files by character count in directory

I would like to divide multiple text files in a directory into many smaller text files by a given character count. For example, I want each file in the directory to be divided into smaller text files ...
0
votes
1answer
21 views

Is it possible to output full command names with `lsof -nP -i4UDP`?

Is it possible to output full command name with lsof -nP -i4UDP? I've been looking in the manual for a suitable option, like -V (see below), but it doesn't result in full COMMAND names, i.e. systemd-...
0
votes
1answer
28 views

Archive files not modified for more than 6 months

I have a python method to archive files not modified in 6 months to another drive by iterating through the directories. But what is the fastest way to find all non-modified files from the whole ...
0
votes
1answer
23 views

Sorting file based on “file” output into folders

I am having millions of files without extension and I want to sort them into various folders. I am able to identify the files by "file" but then I end with lot of different types which I can ...
0
votes
0answers
42 views

single command to `mv`/rename/move a file and set the user, group & permissions?

I can copy a file with cp. But with install I can copy a file, and set the owner, group and permissions on the new destination file, which is useful. With mv, I can rename/move a file, which (if it's ...
0
votes
0answers
71 views

Why do I receive intermittent I/O Errors that say “Couldn't open text file” when using pdftotext while looping through directories?

I have a bash script with a loop that uses pdftotext to convert many pdfs to text. Below is the relevant portion of the code: cd /data/user/Data/Reports/pdf/ dirs=(A*/) for directory in "${dirs[@]...
0
votes
2answers
30 views

How to output the amount of documents per author in a directory

I am trying to count a set of documents from a text dataset by author. I have a directory of books which are named by the author followed by the title. I want to output the number of documents in the ...
0
votes
3answers
48 views

How to use inotifywait to call script that read from stdin

I have this code: inotifywait -m -e close_write src/lips.js ./test_port.scm | \ while read x; do ./test_port.scm; done The problem is that my script read what inotifywait produce. So my question is: ...
0
votes
2answers
42 views

Writing to the file in unix

I'm facing some problems in writing to the file in unix [ -s $PWD/MEN/*sub.wav ] && echo "File there" || echo "File Not there" > temp.csv I'm trying this unix command ...
0
votes
1answer
44 views

After unzipping text files the format of contents are changed

I zipped a few text files and sent as attachments to my email. After extracting the text files, their format was changed. Before: line1 line2 line3 After: line1line2line3 Is there a way to keep the ...

1
2 3 4 5
86