Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
17 views

Writing to /root/workspace doesn't break the files inside encrypted partition

I have made full disk encryption on my hard disk exactly as in this guide https://web.archive.org/web/20180428191153/http://thesimplecomputer.info/full-disk-encryption-with-ubuntu Partition table: ...
0
votes
0answers
14 views

Choosing a tool for two-way syncing folders over internet on CentOS [duplicate]

I'm looking for a tool which can sync files and folders over internet on CentOS 7. It better run as a daemon in real-time or short delay when files/ folders changes. I need to sync multiple folders. I ...
0
votes
0answers
15 views

Static Tomcat Site on Ubuntu - unable to reach files/directory with white space in url?

I am migrating a legacy image hosting server from Windows with weblogic to Ubuntu with tomcat. the server provides images directly from the file system with URLs mapping to the physical. I have ...
1
vote
1answer
78 views

I want to find if a word exists in a file

I have a directory with some files. I want to know if a word exists in each file. $1 is my directory that I give it as a parameter e.g. ./myscript.sh /mnt/c/User/er/Desktop/shows I have written ...
0
votes
1answer
38 views

Creating text files in every sub-directory

I have a directory hierarchy named, for example, abc and a text file names.txt. I need to choose several lines from the text file and then create new files with sample text, say "Hello world", in ...
1
vote
2answers
28 views

Search recursively each row on a file to another file and print the output to new file [on hold]

I need to get a listing of thousand of servers living on virtualized environment. On a file I have something like this: Name Host sysserver0012 btesxid432.eu.domain.com sysserver0015 ...
0
votes
2answers
36 views

Would a forked child always get same File ID as parent's file ID?

This might be a naive question, but given in parent open call returned me File ID 4. Is it guaranteed that child process will always get a File ID of 4 as well ?
0
votes
1answer
49 views

Searching files in $PATH

I have some folders specified in my PATH environment variable. How do I list all the files in these folders?
0
votes
1answer
76 views

Does constant writing to “files” in `/proc` or `/sys` reduce the life of my SSD due to its limited number of writing cycles?

My laptop has a SSD drive and I run a script which writes every other second to /sys/class/thermal/cooling_device4/cur_state. I don't think this would count as writing to the SSD and thus reducing its ...
-1
votes
3answers
91 views

How to prevent “rm -rf ~” from being executed by mistake?

Is there any way to completely prevent this command from being executed, by mistake, in the terminal? I know that bash, for instance, has aliases. Is there a way to use them?
1
vote
0answers
34 views

Installing software in home partition instead of root partition?

/home (the rest) / (100GiB) /swap (6GiB) /boot (200MiB there are vital basic operating system packages like the coreutils and binutils, then there's the "optional" like virtualbox or okular thing ...
0
votes
1answer
32 views

What happens if we, recursively, change folder permissions after changing files in it?

What will these below commands actually do? chmod 777 /yoda/htdocs/cups/logs/* chmod -R -f 777 /yoda/htdocs/cups/logs/ When I check the file permissions in ..../logs folder, they are showing as -...
2
votes
1answer
22 views

Filter files by string timestamp in filename

I've got a folder with several thousand files with names like ousjgforuigor-TIMESTAMP.txt The timestamp is a standard Unix timestamp (e.g. 1543932635). Is there an easy way to list only files with a ...
4
votes
3answers
156 views

Add lines to files to make them equal length

I have a bunch of .csv files with N columns and different number of rows (lines). I would like to add as many empty lines ;...; (N semicolons) to make them the same length. I can get the length of the ...
1
vote
0answers
32 views

Whose `I-Node` does `netstat -ap` for unix domain sockets refer to?

What does I-Node mean in the output of netstat -ap for unix domain sockets? It seems not the same as the inode of the socket file: $ netstat -ap ... Active UNIX domain sockets (servers and ...
0
votes
0answers
17 views

Samba 4.7.1 multiple shares and access (CentOS 7.5)

I have started a file sharing server based on Samba 4.7.1 and CentOS 7.5 My goal is to setup private shares for groups or single users and one public share with only to read permission. I made ...
0
votes
1answer
31 views

What level is the value `ulimit -n`mean? user level or process level? [duplicate]

I want to increase the ulimit -n value,so I add * soft nofile 20000 * hard nofile 20000 in the /etc/security/limits.conf file, but there is a question confuse me all the time. what ...
0
votes
1answer
29 views

How do I create a new user and a new file in its directory?

Introduction I need to create a new user, and it needs to have a custom file named "config.sh". Question So far what I do when creating a new user is: sudo useradd –c "New User" –md /home/NU ...
0
votes
1answer
23 views

Lightweight application to send files via browser with http

I have a server allowing traffic only on port 80 and 443. I need to upload a file to said server. Isn't there any application allowing me to upload a file to a server folder via browser?I have apache ...
1
vote
2answers
36 views

Make script to create subdirectories based on file name and move matching files into it [duplicate]

A folder has a huge number of files; each pair of files has the same name but different extensions (.obj and .mtl). I want to make a folder for each pair of files with the same name, then move each ...
0
votes
2answers
44 views

Batch rename media files

I have an Enigma2 FreeSat recorder that I've now hooked up to my Plex Media Server. Plex can see and play the files from the Enigma2 just fine, but the file naming makes this unattractive. How can I ...
-1
votes
3answers
25 views

The most recent files in directory with a specific format in each one

I would like to have in a variable the most recent file with a specific format. exemple : in /home/test, 5 files : file_test_hadoop_20181130.csv (This is the last modified one for hadoop file) ...
0
votes
1answer
46 views

Get lines of file matching a regex

Is there a more compact way to get lines of a file that match a regex than the following? open my $fh, '<', $file or die "Cannot open $file: $!"; while ( my $line = <$fh> ) { next ...
0
votes
2answers
26 views

Move contents of all sub subdirectories up into just their subdirectories

The problem I am facing is that I have a directory that contains thousands of subdirectories, each of those subdirectories contain more subdirectories, and inside of all of those are images. What I ...
0
votes
3answers
38 views

move a list of files to a list of locations

I'd like to move multiple files at the same time to specific new locations. Say I have the following wrong name | c.txt | a.txt | b.txt | Correct name| a.txt | b.txt | c.txt | I'd then like to ...
24
votes
2answers
3k views

Purpose of cp -x (stay on file system)?

If I wanted to stay on the same file system, couldn't I just specify an output path for the same file system? Or is it to prevent accidentally leaving the current file system?
1
vote
0answers
32 views

Is it possible to get which process changed my file [duplicate]

I have many processes running on my Ubuntu. One day later, I find that one file has been changed. Now I want to know which process touched my file. What can I do? (I can not modify the running ...
0
votes
0answers
14 views

How to see the file revisions in Tux3 and NILFS?

Tux3 and NilFS are file systems made for file history/revisions. How can I see these revisions? On Windows, there is a file history manager and Shadow Copies (enabled by default only on Windows 7 ...
8
votes
3answers
310 views

How to find files by file type?

I know I can find files using find: find . -type f -name 'sunrise'. Example result: ./sunrise ./events/sunrise ./astronomy/sunrise ./schedule/sunrise I also know that I can determine the file type ...
1
vote
1answer
34 views

Why some file headers have a magic number [closed]

Some files like PNG and GIF have a magic number in the file header. It is used to "identify the file" as a specific type like PNG. You just check the magic number and that tells you the type. But I ...
3
votes
3answers
365 views

Bash misinterpreting a sed statement to rename files [duplicate]

I would like to rename a series of files named this way name (10).ext name (11).ext ... to name_10.ext name_11.ext ... This one-liner works: $ for i in name\ \(* ; do echo "$i" | sed -e 's! (\([0-...
1
vote
2answers
57 views

how to find duplicate field in over 100 files

I have about 120 files each with >1000 lines Each line has it's own key in it. The columns are | separated here is an example line, the key column (column 11 always column 11) is: 2010\07\05\...
0
votes
2answers
27 views

Dropbox-like solution for two power users with dynamic IPs that doesn't use the cloud?

A friend and I share a lot of files between ourselves. We would like a way that makes it easy for us to send files to one another without the need for the other to be there to accept the transfer. i.e....
0
votes
2answers
35 views

Rename multiple files in sub directories to their directory names

I have a folder on my desktop named Models. In the folder, there are named folders with jpeg files without the .jpg extensions. The jpeg file names are random hashes. I would like to use a bash script ...
1
vote
1answer
17 views

Finding duplicate files and moving ONE copy to another drive, deleting all other copies

Actually I am trying to do two different things.... First off is to make a copy (onto my travel HDD) of all the video files, photos and documents, excluding any duplicates. So there is only one copy ...
-1
votes
2answers
44 views

Find all shell scripts from a folder and execute them in order

I have a folder with a lot of shell scripts to configure my server. My main script is named "setup.sh" and all others scripts are named 0.script.sh, 1.script.sh.... More generally N.SCRIPT_NAME.sh, ...
0
votes
0answers
48 views

What does rm do specifically? [duplicate]

Rationale: I have been looking into options for recovery of accidentally deleted files on linux systems without a GUI. During my research I realized that there are many posts explaining how to use rm, ...
1
vote
2answers
44 views

gzip multiple files and rename them

I have to gzip multiple files in a directory and rename them. I dont want to zip them into a single zip file. i.e. gzip: ABCDEPG01_20171120234905_59977 ABCDEPG02_20171120234905_59978 ...
0
votes
1answer
27 views

File Permission - Only let script read?

I have a password stored in plaintext. I only want my expect script "LoadList" to be able to read the password in order to spawn an SFTP session. There's no scenario in which I want to be able to read ...
0
votes
0answers
17 views

How to delete backed files only from original storage device?

I have a backup of an SD card but have not yet deleted the original files to free up space. Now, they got mixed up with new files. How do I delete all files that are already backed up (same file name ...
0
votes
0answers
53 views

Is there any other way than symlink and hardlink to link files in Linux

Instead of copy files from a directory to another directory. The file contents should change, if files that exist in another directory contents are changed.
0
votes
2answers
50 views

Extract information from multiple log files

I am trying to make a .txt file that contains only one line gathered from other 30 .log files. To extract only one line I used this: $ sed -n '/Num mapped reads/p' /home/travc/seq_v2/AgamP4_v2/...
-2
votes
1answer
46 views

What do you understand by this line “dr— -w- --x file” [duplicate]

As far my assumption it is related to directory but after that i cannot understand the remaining pattern
-2
votes
1answer
33 views

creating test1 and test2 files in /var directory in Linux, [closed]

I need to create test1 and test2 files in /var directory in Linux , and creating Hard link for test1 file and soft link for test2 file in /tmp
1
vote
0answers
13 views

Linux Mint cannot access USB drive from an admin accout. Drive is detected and works fine in other accounts on the same machine

I have a weird problem on a Linux Mint 18.3 Serena Mate install. USB drives (I have tried a few) are detected and appear on the desktop but cannot be accessed in this account. The account has admin ...
1
vote
1answer
46 views

unlink delete files which are not links [duplicate]

I created a hard link $ ln hours.sh hours_link test it $ ls -l hours* -rw-r--r-- 2 me staff 653 Apr 12 2018 hours.sh -rw-r--r-- 2 me staff 653 Apr 12 2018 hours_link remove it with unlink $ ...
2
votes
3answers
128 views

How to compare two files and if found equal ask the user to delete duplicate file by using shell script?

I am learning linux and was given this problem as my homework but i can't solve this that how we can compare two files content in shell mode. (Here, we can assume that both files having text content ...
14
votes
7answers
1k views

How can I check if a file can be created or truncated/overwritten in bash?

The user calls my script with a file path that will be either be created or overwritten at some point in the script, like foo.sh file.txt or foo.sh dir/file.txt. The create-or-overwrite behavior is ...
0
votes
2answers
31 views

How to copy all files in all directories with specific filename to one destination?

Let's assume that I have these files: /1/tEst.mp4 /1/Test.mP4 /1/subdirectory/TEST2.mp4 /1/.20181106Test2.mp4 How can I copy all of these files into /2/Videos with a single command line? All files ...
3
votes
1answer
41 views

Page cache behavior guarantees and log files

Are there any guarantees as to when and in what order dirty pages are written out to disk? In the specific case of log structured files (files that are only ever appended to), is it possible for dirty ...