Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
2answers
49 views

Unix command to get 0 count , when no files present for the day along with count

How to do I get the list days were no files been received. Have used the below command to get the file count along with the date: find . -maxdepth 1 -type f -printf '%TY-%Tm-%Td\n' | awk '{array[$0]+=...
-2
votes
0answers
9 views

HSH File formate ^~ [on hold]

HSH File formate the symbols ~^ in the file naming convention below essential FileName,~^MONTHLY_STATEMENT_DD_MMM_YYY~^.PDF,"MONTHLY Statement DD MMM YYY"
1
vote
2answers
266 views

Cannot read regular file - IO operations block

I'm writing a program that scans through all files in an Android device, looking for a specific string. A few seconds through the process, I get stuck on the following file: /sys/power/wakelock_count ...
7
votes
5answers
14k views

How can I use rename to recursively rename everyting to uppercase

I'd like to recursively rename all files and folders (sub-folders) to uppercase. I found some scripts that will do it to lowercase, but I don't know how to change them so it will do it the other way ...
-1
votes
2answers
46 views

Is it possible to recover a deleted file from crontab -r? [duplicate]

I made a very serious mistake. I was editing the crontab file of my remote server, I was as the root user and it turns out that I wrote crontab -r instead of crontab -e and without previous notice it ...
2
votes
1answer
93 views

Timestamp of file on mounted drive shows 1 hour lag

I have a very specific and a very puzzling problem. If I modify (touch) file located on mounted drive the file's timestamp shows the latest modification time as exactly one hour before the actual ...
3
votes
2answers
121 views

How to pass multiple files in one stream to process them pipe-like (without saving) on the receiving side?

I need to determine the filetype on an indeterminate number of base64-encoded filestreams coming from stdin (image files base64-encoded and cat'ed). A single file would simply be ... | base64 -d | ...
2
votes
4answers
189 views

Duplicate a file multiple times, write to duplicated files, sort the files, count position of specific lines after sorting

Before I go to more in details, I want to point out that I already asked a certain part of this question -> You can find it here. I received some nice answers, but I need to do more so I'll repeat my ...
0
votes
1answer
47 views

How to give permissions to all files of a server in a user without making him the owner

Recently I had a project which was about ssh connection with an Amazon EC2 server. In this project I was asked to create a user than can have read permissions -only- to the whole server (all files in ...
0
votes
0answers
29 views

cant delete files

im tidying up my back up drive root@raspberrypi:/media/pi/Seagate Expansion Drive/Jane-PC# ls -la | grep Goo drwx-w--w- 1 pi pi 4096 Nov 17 2016 Google Calendar - Month of Nov 2016_files -rw-----...
0
votes
3answers
77 views

How to find the string in the list of .gz files?

I have a list of folders in each folder I have around 600 .gz files which are automatically generated by the system every 15 min. I need to display the particular string which is repeated in that .gz ...
12
votes
4answers
1k views

How to rename multiple files in a directory at the same time

I have directory say /var/tmp/abc which has 4 files: 12345-ram-3e3r5-io9490-89adu9.csv 45434-dam-qwe35-to9490-43adu9.csv 11234-cam-yy3r5-ro9490-85adu9.csv 14423-sam-hh3r5-uo9490-869du9.csv I want to ...
0
votes
2answers
40 views

Owner of the file not being displayed properly in LINUX Terminal

I want the terminal to display the user name that created a particular file, so when I traverse all the way to that file and type in the command ls -l filename.docx or even ls -la /path/to/file, it ...
0
votes
1answer
50 views

Moving files to a bin [on hold]

I am having issues with my code below: #!/bin/bash #Removing Files into the Recycle Bin(Deleted Directory) filemove=$1 #Saving the first argument as "filemove" mkdir -p ~/deleted #Create the deleted ...
1
vote
2answers
2k views

Move multiple files with same name in same directory

I have a directory with multiple files of same name. ../directory ls File.txt File.txt File1.txt How can I move all files to a new directory (/new) using mv ../new ls File.txt File.txt File1.txt ...
1
vote
1answer
16 views

NFS client resetting another NFS client file pointer

I have a device that writes logs to a logfile on an nfs mountpoint. It writes to the same logfile "forever" resulting in a file that gets insanely large. I have a script (running on another nfs ...
1
vote
2answers
37 views

View and delete part of data in binary file

How to delete part of binary data from binary file? (hex dump). I tried GHex 3.18.0 binary file editor, but it's not suitable for this, just lack even simple features. For example, I need select the ...
4
votes
3answers
620 views

Explanation for the meaning of content of the /var/run/utmp file

I would like to understand the content of the following file system /var/run/utmp. When I use the command od to open it I see the following: [john@iceman ~]$ od -c /var/run/utmp 0000000 002 \0 \0 ...
0
votes
1answer
59 views

Converting multiple commands into a for loop

It gets annoying to retype the commands in the terminal so many times. Basically, instead of just running these commands for ogg_2x2 or ogg_1x1 like in the examples in the image, I need to run these ...
2
votes
0answers
77 views

test fails to find files with processed path

I have backup of /home/kuba/mp3 on external usb hard drive /media/kuba/JCUBIC/mp3 and I move some files to different directories on usb drive and now I want to sync the files from usb to my home ...
2
votes
0answers
33 views

Automatic symlink to latest folder

Is there a way in Linux to automatically maintain a symlink to the latest version of a file/folder in a certain location? My use case: I generate datasets with unique job names, then write them to a ...
0
votes
1answer
53 views

Restore function in unix

I have a script to recover files back to their original location. I am missing the options for the script to as "Do you want to recover this file?" Yes or No. How will I implement it into this code ...
1
vote
2answers
31 views

standard/simple way to mount remote directory

There is a shared_data directory in each of my client machines and I want to mount them all in my server. What is the most simple/standard way to do it? NFS seems more suitable for sharing directories ...
1
vote
2answers
32 views

Overwrite or don't copy?

I'm trying to copy a file only if it already exists, not if it doesn't, basically overwrite only on Linux. Does anyone know a solution? I basically need to "look" for a folder then if a file exists, ...
1
vote
0answers
28 views

Curl download speed restricted when down/uploading from stdin/stdout

I'm running 2 curl commands where one downloads all the data into stdout/in until the stack is filled and another uploading whatever is in it out but it seems like the speed is restricted. For the ...
0
votes
2answers
34 views

How to find more than one space and replace it with one space?

I want to find repeated spaces (more than one) and replace them with one space. I tried: sed -e 's/ []+/ /g' myfile.txt > myfile2.txt This resulted in an empty file. Why? and how to achieve my ...
9
votes
5answers
15k views

How to give permissions to read write but not delete the file

I want to give users the ability to create write and read files in other user directory, but not to have option to delete the file after created ( sticky bit not going to work here ... ) for example :...
0
votes
1answer
16 views

How to express beginning and end of line in sed

I want to use sed to replace every '} that comes at the end of the line to "}. I wrote: sed -i -e "s/'}$/\"}$/g" But this replaces it to: "}$. What is wrong? How can I use regex in my sed to express ...
-1
votes
1answer
64 views

Bash script: Sorting video files by duration [on hold]

I have multiple video files with different duration in one folder and I would like to sort these files per 1 hour. What I need to do: get the duration of video files, then move files into ...
15
votes
2answers
13k views

viewing dll and exe file properties/attributes via the command line

I have a need to see some additional file properties for exe and dll files. If I open windows explorer and add the additional columns to my view, I can see things like Company, Copyright, Product ...
0
votes
0answers
9 views

UsbFlashDrive.getLabel meaning

reading through the system logs I can see those two messages USBFlashDrive.isMediaPresent - the media is present in the device USBFlashDrive.getLabel - Getting the label for the USB flash memory ...
0
votes
0answers
33 views

Industry standard for copying large files, when the transfer could break [on hold]

Based on comment from: What are the temporary files that rsync uses while continuing a breaked copy? UPDATE on 2019 May 13: my god, I can see these are almost duplicated datas... so when you are ...
2
votes
1answer
55 views

Looped sed statement - weird output

I wrote a small script that will recursively go through all *.py files within a directory and replace specific entries in the files. So the files and their current content: find . -name "*.py" -exec ...
0
votes
1answer
29 views

How to search for a newline that is not preceeded by } and remove it

I want to use sed to search for line breaks that are not preceded by }. The regex for identifying theses cases is: [^}]$ . What I want to say: If the line ended without } then remove the new line. ...
4
votes
2answers
245 views

Size of a folder with du

I have copied a folder using rsync including symlinks, hard links, permissions, deleting files on destination et cetera. They should be pretty identical. One folder is on a USB drive and the other on ...
0
votes
2answers
95 views

How can I unlock a file locked for editing by DESKTOP/Username?

How can I unlock the file below on Mint 19? This is a LibreOffice document I had opened when my PC crashed.
1
vote
1answer
34 views

How to get the list of files in a directory

I try to create an array/list which stores file names inside a folder. The below command creates for unknown reasons a :. How is possible to remove :? > a=$(ls split*) > echo $a split_sam....
0
votes
1answer
35 views

very long string variable?

Is there a longer type variable for building lengthy sql statements? how add new line too? I want to store the statement in a very long variable text so I can run it from sql prompt. I think it will ...
2
votes
2answers
2k 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 ...
40
votes
4answers
112k views

'chmod g+s' command

Hello I want to understand the role of the chmod g+s command in Unix. I also would like to know what it does in this particular context: cd /home/canard; touch un; chgrp canard .; chmod g+s .; touch ...
-1
votes
2answers
26 views

Renaming files with numbers

I have files: file1 file2 file3 ... How to rename them to file501 file502 file503 ....
18
votes
4answers
10k views

Precedence of user and group owner in file permissions

I just ran into something unexpected (for me) regarding file permissions on Linux (Arch Linux). Basically I have: userX in groupX fileX userX:groupX ---rwx---- What puzzles me: I cannot perform any ...
1
vote
2answers
2k views

CentOS 7.1 - how to install gnome commander

I have CentOS 7.1 and cant install gnome Commander. I dont see it in the Software module as well as yum install gnome-commander does note see the package. I tried RPMs from http://rpmfind.net/linux/...
7
votes
3answers
442 views

How can I list files in reverse time order by a command and pass them as arguments to another command?

I have a program which takes in some files as arguments in one command line. I would like to invoke it with all the files in a directory listed in reverse time order. For example: I have following ...
65
votes
6answers
34k views

Flattening a nested directory

This is probably very simple, but I can't figure it out. I have a directory structure like this (dir2 is inside dir1): /dir1 /dir2 | --- file1 | --- file2 What is ...
0
votes
3answers
981 views

how to move files with multiple patterns to specific directory, bash?

Need move files with multiple, defined patterns, like: Z_*ana_bwk_na_N*.png Z_*ana_bwk_dwda*.png Z_*ana_bwkman_dwdna* Z_*ana_bwkman_dwdc* Z_*EDZW*_nwv01*_p00_na_N*WV11.png Z_*EDZW*_nwv01*_p00_nh_N*...
0
votes
2answers
52 views

Moving multiple files to multiple directories by percents

I have a directory with 100,000 files. These are audio files which I need to move to three different directories, train , dev and test. In the order of 80% , 10% and 10% respectively. mv `ls | head -...
-1
votes
0answers
28 views

yum + is it safe to delete the _db files before yum update on Linux machines?

Sometimes we get yum errors because the _db* under /var/lib/rpm ls -ltr /var/lib/rpm/__db* -rw-r--r-- 1 root root 1318912 Apr 29 07:56 /var/lib/rpm/__db.003 -rw-r--r-- 1 root root 106496 Apr 29 07:...
0
votes
0answers
19 views

Nautilus alphabetical sort ignores 0

I noticed something interesting and strange in nautilus sorting method. Having a bunch of file named "foo01" to "foo10" plus another one named "foo011", ls returns them in alphabetical order, namely ...
12
votes
5answers
7k views

How to split a file by using keyword boundaries

I have a vcf file that contains numerous vcards. When importing the vcf file to outlook it seems to only import the first vcard. Hence I want to split them up. Given that a vcard starts with BEGIN:...