Logical entities that contain data in a filesystem. Use this tag if your question: is about programs that create files (e.g. gzip, tar, zip); deals with characteristics of files (permissions, size, path/location); or is about management of files (renaming, listing, moving, removing). For operating ...

learn more… | top users | synonyms (1)

4
votes
2answers
50 views

Rename Multiple files gzips them and delete older than 10 days

I'm new to Linux/Unix and slowly learning it step by step. Unfortunately on today’s job interview was surprised by a task to do (which of course I didn’t know). I was asked to prepare a bash script ...
0
votes
1answer
16 views

How to delete all duplicate hardlinks to a file?

I've got a directory tree created by rsnapshot, which contains multiple snapshots of the same directory structure with all identical files replaced by hardlinks. I would like to delete all those ...
2
votes
3answers
11k views

How can I move a file to another user's directory?

I'm using CentOS 6 and I'm trying to move a file from USER A to USER B but I keep getting permission denied. What do I need to edit to allow to me to put files from one user's directory into ...
3
votes
0answers
39 views

Why group-writable file works “unidirectionally”?

Users vi and rust share group rust and want to use some file in shared manner. rust$ ls -l myfile -rw-rw-r-- 1 vi rust 0 May 30 03:48 myfile rust$ stat myfile | grep Gid Access: (0664/-rw-rw-r--) ...
2
votes
1answer
43 views

Stop user from deleting file in directory

This is the scenario There is one directory /test which is owned by oracle.dba I created new user TEST who will have permission to create NEW files but it should not be able to delete the files ...
25
votes
4answers
16k views

Why isn't there any shell command to create files?

Attention please: I am not asking how to make a file from the command line! I have been using touch for making files for years without paying attention that its main purpose is something else. If ...
2
votes
2answers
36 views

Incorrect permissions on special files

I've noticed a lot of special files on Linux have what appears to be incorrect permissions: E.g.: $ ls -l /dev/fuse crw-rw-rw- 1 root root 10, 229 May 29 09:59 /dev/fuse appears writable but in ...
3
votes
3answers
5k views

How to prevent users from deleting a directory?

I tried "chattr +i DIRNAME", it's great, but I cannot create files in the DIR after chattr. What else are there to prevent users from deleting a Directory? root@HOST ~] mkdir test [root@HOST ~] ...
2
votes
2answers
71 views

search contents of files that are packed in a zip file

For my school project i have to create a script that allows you to search the contents of files that are packed in a zip file. You can give a "search string" with the script, followed by one or more ...
2
votes
1answer
95 views

How to sort files separately without merging?

File1: Brazil New Zealand Argentina Uruguay File2: Chile Russia Latvia Switzerland I realize that the command sort -n File1 File2 will sort all the files merged together and display it ...
-1
votes
1answer
30 views

How can I successfuly port W10 files to Ubuntu? [on hold]

I just installed Ubuntu (Dual boot with W10) and I can see my W10 partition from inside Ubuntu with all my files. They seem fairly corrupt on the Linux side (Text editors, web browsers, Steam etc) ...
1
vote
1answer
25 views

Finding change in shared object through bash

Here's my case- I have a package named say foo-1.2.3. I want to know which package it installs. So, I install it in a fakeroot approach and make a list of all files it install in a file called FILES ...
15
votes
3answers
11k views

Finding all “Non-Binary” files

Is it possible to use the find command to find all the "non-binary" files in a directory? Here's the problem I'm trying to solve. I've received an archive of files from a windows user. This archive ...
11
votes
3answers
2k views

How to check if two directories or files belong to same filesystem

What's the best way to check if two directories belong to the same filesystem? Acceptable answers: bash, python, C/C++.
1
vote
2answers
32 views

Copying Files before They're Finished Transferring [on hold]

Using Ubuntu 16.04 ext4, especially for chrome downloads. Can you copy files while they are not finished transferring?
0
votes
1answer
46 views

How to merge or join more than 2 files? [duplicate]

I have four files; file1: gene_id FPKM TRINITY_DN56960_c4_g1 36.91 TRINITY_DN42427_c0_g1 12.83 TRINITY_DN48728_c0_g1 6.22 TRINITY_DN50706_c0_g2 6604.75 TRINITY_DN51449_c1_g1 8.19 ...
0
votes
2answers
41 views

How can I copy a hidden directory recursively and preserving its permissions?

mkdir backupcache cp -rp .cache backupcache # or cp -rp \.cache backupcache does not work nothing gets copied and directory backupcache remains empty
0
votes
0answers
43 views

Count and compare files in Linux

I want to just compare the number of lines in two files. Below is the list of names of files. One file contains names/location of fastq files; the other file contains names/location of bam files. ...
2
votes
2answers
57 views

find command, is there a way to get a progress report?

firstly please forgive my lack of knowledge of Unix - that's why I'm here after all. I've created an AppleScript which searches for files on a Mac and have greatly improved the speed by using the ...
0
votes
2answers
37 views

Copy and rename on collision

I'd like to merge the content of these folders with a command line. . ├── folder1 │ │ file.txt │ ├── folder2 │ │ file.txt │ └───folder3 │ file.txt How can I do this ?
1
vote
2answers
50 views

How to determine which files are necessary in /bin, /lib, /var, etc.?

I'm currently trying to get an image working for a network boot using somebody else's file contents. The previous images I made keeping all original files present were way too big, so I need to shrink ...
-1
votes
1answer
19 views

Move all sub-directory content up one level

My top level directory contains a bunch of sub-directories: af ar ca cs da de el en ... (lots more) Each of these directories has the exact, same structure. They contain two directories: v2.3.0 ...
1
vote
4answers
74 views

Bash script to fix file names

I have hundreds of folders with thousands subdirectories and files inside of them. The file names are currently in the format sf{number}-{number} - {text} and I need everything deleted until ...
1
vote
1answer
22 views

Delete old package versions within a backup folder

I have a folder that contains a large number of tar.xz packages that have their version number in their filenames . ex : vlc-2.2.2-3-x86_64.pkg.tar.xz (old and should be deleted) ...
18
votes
4answers
2k views

Can a file that was originally sparse and expanded be made re-sparse

I know that copying or transferring what was originally a sparse file without using a utility that understands sparse files will cause the 'holes' to be filled out. Is there a method or utility to ...
69
votes
6answers
172k views

How can I count the number of lines of a file with common tools?

I am redirecting grep results to a file, and then using cat to show its contents on the screen. I want to know how many lines of results I have in my results file and then add it to some counter. ...
1
vote
1answer
22 views

Compressing a folder but do not compress specific file types but include them in the gz file

I am using tar with pigz to compress a folder and save a backup. Size of this folder ~250 GB or more. This folder has variety of content including numerous text and log files, ISOs and zip files in ...
1
vote
0answers
25 views

rhel - file modification logs

I found a strange file in my /home/user named FireZeMissiles1111.tmp. I am the sole user and did not create it, so it is kind of suspicious. It may have been left there by a program who's programmer ...
1
vote
2answers
74 views

search for files with specific text and copy these files to another directory

Relatively new to unix and still learning -- How do I search for files in a directory that contain a specific text and copy them to another directory ? I am using .ksh shell.
0
votes
1answer
51 views

Validate user response in shell script

My shell script is working fine and the files are copying to the remote directory. However I need to check if my INPUT_STRING is starting with S and also check if the files are present in the ...
1
vote
1answer
45 views

Why are given file sizes slightly different between Windows and Linux?

I have just transferred (via scp) a bunch of .gz files from a Windows machine to my Linux machine. They are large files so I checked they had transferred entirely by comparing file sizes. Those that I ...
7
votes
6answers
687 views

Number of files not containing given string

I read the question about how to find out the number of files that contain a certain string. This is possible with grep -l "string" * | wc -l. Is it possible to invert this, finding the number of ...
2
votes
4answers
97 views

Copy files to new directory only if name of file is in an array

I'm not much of a zsh buff but I imagine this should be an easy layup for someone: I can bulk copy files from sourcedir to targetdir with the following: $ find sourcedir -type f -exec cp {} ...
4
votes
4answers
217 views

Prefer file types in command line

Often I have to annotate multiple pdf documents using xournal. If I start with a directory of "fresh" pdf files, I just open them all with xournal: for f in *pdf; do xournal $f&; done When I ...
0
votes
0answers
20 views

Assign a name to an inode [duplicate]

As far as I can tell (from what lsof tells me), once a file is opened by a process, I can rm it and the process will still be able to access it, because at that point all that counts is the inode. ...
20
votes
8answers
39k views

Test if there are files matching a pattern in bash

I am trying to write an if statement in bash to test whether there are any files matching a certain pattern. If there is a text file in a directory it should run a given script. My code currently if ...
1
vote
1answer
56 views

copy huge number of files into date structured directory order

I need to copy around 40.0000 files into date structured folders. example file: /var/public/voicelogging/quality_monitoring/20151209/bbbbbb_I_20151209-185841_xxxxxx_12434_89343.WAV Is one of the ...
2
votes
3answers
157 views

reformat a text file to have all text on one line using CentOS 5.6

I have a 210-line block of HTML that I have stored in a HTML for debugging purposes. The HTML, as you would expect, is formatted accordingly so is stored in the file with spaces and tabs. Is it ...
5
votes
1answer
469 views

Using syncing files only comparing file name and not extension

I'm trying to sync 2 folders containing audio files of multiple types (WMA, MP3, M4V,...). I want to sync these folders but the sync process should only take into account the file names, not the ...
17
votes
3answers
34k views

How do I use wget with a list of URLs and their corresponding output files?

Suppose list_of_urls looks like this: http://www.url1.com/some.txt http://www.url2.com/video.mp4 I know how to use that with: wget -i list_of_urls But, what if my list_of_urls has this, and they ...
13
votes
2answers
637 views

dd: write to multiple disks?

I have 2 exactly same formatted, same size and same brand SD-cards. I would like to dd image to /dev/disk2 and to /dev/disk3 at the same time. Pseudocode sudo dd bs=1m ...
2
votes
1answer
31 views

Find differences of ownerships between two home folders?

I have two home folders: /home/masi and /home/masi_backup and I would like to find the differences between files of the two directories. Pseudocode vimdiff <`ls -la /home/masi` <`ls -la ...
3
votes
3answers
1k views

How to count occurrences of all the words in all the files of a directory using grep? But with count incremented only once per word per file

I have already asked a similar question but people misunderstood what i was asking. I was asking how to generate a list of every word with a word count incremented only once per word per file. For ...
0
votes
1answer
61 views

inserting modified date into filename - 2 cases

I believe I'll ask two separate questions, but the context is the same, so I hope it's alright. I have an output of few processes as presented below (which I can't modify). 25978.csv 26044.csv ...
1
vote
4answers
56 views

How to gather the name of the files in each subdirectory into a text file in that subdirectory?

I wanted to save the names of all files in each sub directory into a text file in that sub directory, so I wrote this script: #!/bin/bash for X in "$PWD" * do if [ -d "$X" ]; then ...
1
vote
3answers
96 views

How can I compare different files without opening them?

I have two directories A and B; each one contains a lot of sub-directories geom001, geom002 ....etc each sub-directory contains a file named results. I want to compare, without opening any of ...
4
votes
7answers
718 views

How to split a filename list in 5GB sets?

I have a pretty big list of files which I like to group in smaller list of 5GB each for further processing. The file list is in the following form: "size" (from du) "tab" "absolute path", like this ...
0
votes
0answers
18 views

burn ISO + save other files

is it possible to burn a linux installer on a flash drive with rufus on my 8gb flash and then after the ISO finished burning, just copy paste in 1 folder some other files. And then the istallation ...
0
votes
0answers
37 views

hidden directories to ls (not dot prefixed file)

I'm facing with a uncommon issue, which is: After btrfs read failure and a btrfs check --repair on my partition mounted in /home, it seems that some directories have disappeared. I explain : When I ...
3
votes
1answer
27 views

What are semi-files?

I'm reading a paper about Android/Linux. It contains a line I'm not able to understand. I tried searching about "semi-files" but nothing relative came up. Can someone please rephrase it or explain it ...