Use this tag for questions about file management and operations on files.

learn more… | top users | synonyms (1)

0
votes
1answer
31 views

Find unique files between two directories (recursively)

I am backing up files, and I have a lot of files duplicated in multiple locations. I've used fdupes to find duplicates, but I'm actually looking for some sort of inverse of this tool. I want to see ...
1
vote
1answer
29 views

Crontabbed shell script not able to create/write to a file

I have written a simple shell script to backup the tables in my DB using the mysqldump command. The command simply dumps the DB into a dbName.sql file. However, if the dbName.sql file doesn't already ...
0
votes
2answers
22 views

Script to SSH to multiple Linux Server and execute a find command

I need a script that can SSH to multiple servers and execute a find command to check when was the last time a file was created. I can get the fine command part, but I'm a little bit lost on how I can ...
-1
votes
4answers
138 views

How do I list files ending in txt only on Unix?

I have a directory with nine files in it. 1 ending in .bat 2 ending in .bak 4 ending in .txt 2 ending in .xtxt My question is, how do i list only the files ending in txt, but without the period. ...
5
votes
4answers
421 views

What are the root permissions for a file?

If I type: ls -l file.txt I see that the rights for that file are equivalent to "456": 4 = owner (r--) 5 = group (r-x) 6 = others (rw-) Which the rights for root in this case? Does it have 777? ...
0
votes
1answer
19 views

Deleting a file object from a library

I've created a library with 3 file objects using: ar rv arhiva.a file.o file2.o file3.o Why I can't delete a file object from it? I've used ar xv arhiva.a file.o
1
vote
1answer
41 views

Rename files based on directory names

How can I rename .jpg files in multiple folders based on the name of the folder? I also want the .jpg files to remain in their respective folders and not moved. The folder names have no spaces. So, ...
9
votes
5answers
775 views

How to get the last N files in a directory?

I have many files that are ordered by file name in a directory. I wish to copy the final N (say, N=4) files to my home directory. How should I do it? cp ./<the final 4 files> ~/
1
vote
1answer
19 views

output log file from some time to some time via ssh

I have a access_log which size is neally 2GB. I want to analyze it from 2015:09:55 to 2015:09:57, but during this period, there have more than 500 items. So I want to output and download the ...
1
vote
1answer
35 views

How to upload to a unix server?

Im a part of a project group, and one of our tasks is to upload some content to a server. I am completely new to this and have some questions. There are content on different servers(distributed on ...
1
vote
2answers
51 views

Read line from file then delete

How can I read a series of lines from a file and then remove each line? Obviously I can read like this: while read -r line; do echo $line done < myfile.txt But if I do this: while read -r ...
2
votes
2answers
26 views

How to remove “lock” from deleted, but still used files on Linux?

SERVER:~ # df -mP /home/ Filesystem 1048576-blocks Used Available Capacity Mounted on /dev/mapper/rootvg-home_lv 496 491 0 100% /home SERVER:~ # SERVER:/home # ...
2
votes
3answers
31 views

How to determine if a soft link's target is a directory or a file?

Given the ll command outputs as follows #> ll lrwxrwxrwx ... How to determine if a soft link's target is a directory or a file from "lrwxrwxrwx"?
-1
votes
1answer
27 views

Show the content of a file in the mail body

I am writing a script where it shows the content of file in the body of the mail. But i am getting error while I am executing it. RECIP="abc@gmail.com" lines=`wc -l $HOME/totals` if [ $lines == 6 ...
0
votes
1answer
15 views

Many files in folder - time difference while accessing file with fullpath

Folder /var/log/something may have 1 file (test.log) in it or 1000000 different files (and test.log of course). Is there a time difference while accessing file test.log with realpath between those ...
3
votes
3answers
85 views

Get modification date that can be used with touch -m

I need to get the modification date of a file so that I can set it on other files using touch -m. stat or perl -le 'print((stat shift)[9])' Didn't return what I wanted. I think that you are supposed ...
0
votes
1answer
50 views

Bash script, ask for user input, to change a directory, sub directorys, and file's mtime atime linux recursively

Using GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) I am a bash scripting novice, not sure where to begin except at shebang #!. The following command. touch -a -m -t 201501010000.00 ...
1
vote
7answers
176 views

Remove a specific extension from all the files in a directory

I have a couple of files with ".old" extension. How can I remove the ".old" extension without remove the file? I can do it manually but with more work: mv file1.key.old file1.key mv ...
1
vote
1answer
27 views

Read from character delimted file and assign into variables | for email

I am using ksh. I need to read the data from file, into the variables and then further use them for sending emails. File can be delimited by any less used characters (like | ^ etc.) or group of ...
1
vote
1answer
40 views

Chrome too many files open / crash / Sorry Jim

When using Google Chrome I frequently get “Sorry Jim” tabs. The browser also frequently freezes and crashes. Running it from terminal emulator show a long line of Too many open files: ...
1
vote
3answers
41 views

How to access the contents of a file that is used as an argument when running a bash script?

I am running a bash script with its parameters/arguments as files. From inside the script, how do I get the contents of those files? I run the script with this command line: sh script_name ...
3
votes
7answers
578 views

List files whose name begin with any of the characters between a to k

How to list the files whose name begin with any of the character a to k (both inclusive)?
2
votes
2answers
187 views

How to remove all CRLF in file (not replace with LF)

I'd like to remove all carriage returns followed by line feeds (CRLF), such as \r\n in a file. How can I do that? I can't use dos2unix because that replaces CRLF with LF. And I can't use tr because ...
0
votes
1answer
25 views

Recover hard disk file from corrupted one

I bought a 1 TB hard disk from my friend to back up my files but when I tried to copy 150 GB of data to the hard disk, during the last 5MB my laptop shut down due to power loss. After power came back ...
2
votes
0answers
27 views

Prevent scp from overwriting existing files?

Have been googling this for a while, and the problem is not so much of one where I trust my users to "do the right thing" and have them use rsync with various options to avoid overwriting files. I ...
1
vote
2answers
20 views

Common user to modify files owned by 'other' users

I would like to understand how to use the permission system in CentOS to achieve the following: The system has the following users: user1 user2 user3 And the following directory structure.. ...
0
votes
5answers
61 views

Compare one to one lines in 2 different files using shell scripting [closed]

I have two files: File1 File2 abc abc cde cde,xyz,efg,hij,...,n efg lmn,opq,weq,...n Now I want to compare File1 line1 with File2 line1, line2 with line2 and ...
0
votes
5answers
59 views

Getting the shellscript to display a chosen file extension

I'm new to this with shellscript and Linux and now I'm stuck. I shall write a simple program that allows me to search for andy file extension I want and then display how many of them there are. I've ...
1
vote
2answers
51 views

readlink -f not working on multiple files

I tried to run readlink -f on multiple files by using wildcard "*", but it evaluates other files as operand Command readlink -f *log Output (desired) /home/trail_1.log /home/trail_2.log Am I ...
0
votes
4answers
53 views

How does one inspect the directory structure information of a unix/linux file?

In Unix file systems directories are just special files with special directory structures that hold the child filename, filename size and inode reference number. The actual file metadata beyond ...
2
votes
4answers
92 views

Fastest way to read last line within pattern of multiple files with the same extension

I have in a directory /home/files/ some files that all have the same extension .txt. For example 1.txt 2.txt 3.txt 4.txt 5.txt test.txt These files are all the same in data format but the data are ...
2
votes
1answer
44 views

How is the open file table structured?

I'm starting to read Linux Systems Programming, 2nd Ed., and I was curious about the file table that is a "per-process list of open files." Is the file table like a table in a SQL db with the fds used ...
2
votes
2answers
57 views

How to rename thousands of files efficiently?

I have a bunch of music files (literally thousands of files) in my Fedora PC that I'd like to rename with two rules: Every space must be replaced by the character _ (underscore), and Every letter in ...
1
vote
1answer
16 views

What is the difference between these two sets of command for configuring ACL permissions?

Hi I am wondering what is the difference between the two sets of commands below: 1) To allow Davis to access and modify all files and folders in the the home directory of John # setfacl -m ...
0
votes
2answers
16 views

Supervise File Operations

I want to find out what file operations (failed and successful) where performed in the last hour on my system. Is there a way to do that?
2
votes
2answers
66 views

Collect files from several different directories and put them in one place

I have a large amount of ebooks that are very disorganized. Some of them are alone in their own directories, some of them are corrupted, some of the directories are empty. How do I gather my ebooks ...
1
vote
1answer
20 views

Openbox Syntax Error in ~/.config/openbox/rc.xml [closed]

I added a new keybinding to my rc.xml and now I get this message every time I log into Openbox. Also, the right-click menu does not work anymore either. Now I would have fixed the error myself, but ...
0
votes
0answers
41 views

Sudo User: Not able to see the home directory of other users

I created sudo user hrsupport with following commands: hrsupport ALL=ALL, NOPASSWD: /bin/chown, /bin/chmod, /bin/chgrp, /scripts/pkgacct, /scripts/restorepkg How can I achieve this The hrsupport ...
1
vote
1answer
38 views

Still able to read file after changing permissions

I've made a file as root, and written a string in it. Now I've changed mode to "0" like this: root# ls -al transit/ total 4.0K ---------- 1 root root 6 Jan 5 18:15 27050 root# If I try to tail, ...
0
votes
2answers
35 views

Remove all the contents from /root ( /~ )directory

I wanted a software to be installed and its default directory to install was /root. But the software could not get installed. Now I want to do it again from scratch. But there are some files in /root ...
3
votes
1answer
63 views

Copy only file details (file name, size, time) from remote machine in unix

how can we copy only file details (filename, size, time) from a remote machine in Unix? For example: I have a directory (/opt/apache/…/webapps/Context) placed on a remote machine. Now I want to copy ...
3
votes
3answers
99 views

Determine if a file has been modified

In Linux (currently using ext4 filesystem), how can one check quickly if the contents of a file has been modified without reading any of its contents? Is the stat command a recommended approach? I ...
2
votes
2answers
57 views

Find file, check size and overwrite when filesize is different

Today I found a little bug in my own written CMS. Now I want to rewrite all the files on the server with the same filename. However, I do have some customers with the specific file customized so I ...
1
vote
2answers
57 views

What and Why? - File Descriptors [closed]

What is a file descriptor? Why do we need them?
1
vote
2answers
41 views

Delete all files by find

How to delete all files found by this command? find -type f -name "*-thumb.png"
1
vote
1answer
37 views

How to check the file type in a script

I want to do a loop for all the images in a directory. The images doesn't have extension so I have to read the first bytes of the image to know its type. The loop should end up being something like. ...
2
votes
3answers
39 views

Pipe files downloaded with wget into a function

I'm downloading a bunch of images with wget and I want to rm the files if they are empty with a function to which I can pass the file. My question is how do I pipe the images to a function like this: ...
1
vote
2answers
49 views

Creating a list of files, removing “duplicates” with different suffix

I have a problem that (I think) require a bit of script-magic - not sure what would be best though... I have one directory with lots pictures in different formats - jpg, gif, png, tiff and svg. Some ...
0
votes
1answer
77 views

How to move completed torrent downloads to another folder without breaking the torrent link?

I'm using Transmission on EOs and I've downloaded a bunch of torrent files which ended up my Download folder in my /home. I'd like now to move the files to my external hard drive without breaking the ...
1
vote
2answers
61 views

Find latest versions of multiple files in multiple directories

I am writing an application and one of the prerequisites is to be able to look at multiple directories and find the latest version of each file. I've had success with ls and find in order to get the ...