Use this tag for questions about file management and operations on files.
0
votes
3answers
28 views
What does ./ mean?
I'm having a hard time getting what ./ does.
In the Linux Essentials books, it asks me in an exercise to delete a file named -file. After googling, I found that I need to do rm ./-file but I don't ...
2
votes
3answers
181 views
archive files and directories before transfer
I was wondering what is the advantage of making all the files and directories into an archive file for transfer, such as by cpio, instead of transferring them directly, such as by cp, scp?
3
votes
4answers
45 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
...
0
votes
1answer
51 views
Rsync adding a “?” at the beginning of directories
I currently have many of these commands running in a .sh file that looks like this:
rsync -avz -e ssh --rsh='ssh -p1337' --bwlimit=10000 root@DestinationIP:/home/backup /home/localbackup
rsync -avz ...
26
votes
2answers
1k views
Why does a software package run just fine even when it is being upgraded?
Say I am running a software, and then I run package manager to upgrade the software, I notice that Linux does not bring down the running process for package upgrade - it is still running fine. How ...
2
votes
1answer
43 views
Strange changes in files
I have a very strange problem on one of my servers. I'm not sure if it's completely related to linux because it occurs in php and js files.
Today I was trying to backup my databases using phpmyadmin. ...
2
votes
2answers
59 views
Linux listing files between two date without touch command
I need a command which will list the files between given date and time (YYYYMMDDHHMMSS - format) in to a text file.
I don want to use touch command as its creating permission issue.
I am new to this ...
4
votes
3answers
51 views
Dynamic file content generation: Satisfying a 'file open' by a 'process execution'
I have a read-only file, F.
A program, P, that I'm not the author of, needs to read F.
I want the content of F to come from another 'generator' program, G, whenever P tries to read F (taking F to ...
2
votes
4answers
49 views
find command: how to ignore pathname?
I have to find some type of files in a directory and it's subdirectories and I only have to print out the filenames.
So here's the main command:
find -type f -name "*.c"
Now, how could I cut the ...
6
votes
4answers
2k views
Number of files containing a given string
How can I count the number of files (in a directory) containing a given string as input in bash/sh?
0
votes
1answer
21 views
Keyboard shortcut to switch files in one Emacs instance?
I've multiple files opened in an Emacs client. Right now, to toggle between files, I've to click on the file name at the bar below in the editor. Any keyboard shortcuts for switching between files?
13
votes
3answers
10k views
How to merge all (text) files in a directory into one?
I've got 14 files all being parts of one text. I'd like to merge them into one. How to do that?
0
votes
0answers
32 views
Creating and writing to an UTF-8 file with C++ [migrated]
I have to create a m3u8 playlist in my http streaming C++ server code. m3u8 is nothing but UTF-8 m3u file.
How do I create an UTF-8 file (i.e. how to write UTF-8 characters to a file)? Maybe with ...
18
votes
1answer
397 views
How to move a directory, file by file? (instead of “copy then remove”)
My computer has one 500GB drive.
I want to move 400GB of data from /unencrypted to /encrypted.
Both directories are on the same partition, but /encrypted is handled by ecryptfs, so mv /uncrypted/* ...
4
votes
3answers
356 views
How can I exclude files by default with rsync?
How can I exclude files by default with rsync? Here is how my normal rsync syntax starts out:
rsync --exclude ".ht*" --exclude "error_log" --exclude ".DS*" --exclude "old" ...
I've seen a lot of ...
4
votes
4answers
5k views
Linux file access monitoring
Is there any way in unix to find out who accessed certain file in last 1 week? It may be user or some script ftp it to some other place. Can I get a list of user name who accessed certain file? How ...
1
vote
1answer
96 views
reading from a file and changing its pattern into an array?
I have a CSV file containging entries like this :
ipaddress,VLAN,VLANid
10.192.168.1,vlan-xyz,3
10.192.168.1,vlan-abc,8
10.192.168.1,vlan-mnp,11
10.192.163.24,vlan-llz,3
10.192.163.24,vlan-bbz,5
...
2
votes
4answers
102 views
Find and copy directories containing file type
I have a directory "Movies" containing subdirectories "Movie Name". Each subdirectory "Movie Name" contains a movie file and related image/nfo files etc.
I'm trying to copy all directories containing ...
2
votes
3answers
709 views
Gedit won't save a file on a VirtualBox share: Text file busy
I have a text file that I can change using other applications (for example openoffice). But when I try to change and save it using gedit, I am getting error from gedit:
Could not save the file ...
2
votes
1answer
211 views
Samba set share browsable only for a group
How I can configure samba to set browsable a share for a group only.
I wanna hide the share for all other users, if a set browsable to yes all the users can see the share when explore. I don't want ...
4
votes
3answers
739 views
shell script to read from multiple files in parallel
I need to write a script that runs parallel and looks for a string in multiple files. I tried a lot of options but they slow down the speed of my processor.
3
votes
3answers
99 views
How to move all files with a certain file extension from subdirectories to a single directory
I have a directory that contains many subdirectories. The subdirectories contain lots of types of files with different file extensions. I want to move (not copy) all the files of one type into a new ...
11
votes
5answers
6k views
Script to monitor folder for new files?
How do I detect new files in a folder with a bash script? I would like to process the files as soon as they are created in the folder. Is this possible to do so or do I have to schedule a script with ...
16
votes
3answers
2k views
Clone ownership and permissions from another file?
Is there a command or flag to clone the user/group ownership and permissions on a file from another file? To make the perms and ownership exactly "like" that of another file?
2
votes
1answer
38 views
Unable to preserve ownership in a copy but able with a move?
I have noticed that I am unable to preserve ownership if I rsync -o files. However, I am when I move them. This is all without admin privileges. What is the rationale of this? Several threads e.g. ...
2
votes
1answer
47 views
how to keep file owner same for newly created files
This question is regarding samba file access.
I have created a folder A, and under folder A created two folders B and C. And also created three users A, B and C.
User A has access to all three ...
2
votes
3answers
137 views
file mass deletion
I would like to delete all the txt, xls,pdf files in a directory as well as its sub directories. I would like to save everything else.
find . -type f ! -iname '*.xml$,.png$,.jpeg$,.gif$,' -delete
...
6
votes
6answers
5k views
Efficiently delete large directory containing thousands of files
We have an issue with a folder becoming unwieldy with hundreds of thousands of tiny files.
There are so many files that performing rm -rf returns an error and instead what we need to do is something ...
4
votes
1answer
55 views
Can I create a symlink that will ignore subdirectories?
I'm trying to get dropbox symlinked to the relevant folders in /home. I'd like to symlink them like this:
~/Dropbox/Pictures --> ~/Pictures
~/Dropbox/Camera Uploads --> ~/Pictures/Camera ...
2
votes
3answers
43 views
Get files on remote copy but not local
I have a folder.
I have one copy of this folder locally and one on a server. I edited my local folder as I wanted and then rsync it to the server.
Is there any way of comparing those two copies, ...
17
votes
4answers
722 views
Howto find duplicate files on disk
Is it possible to find duplicate files on my disk which are bit to bit identical but have different file-names?
1
vote
1answer
35 views
Getting back rsync's deleted files [duplicate]
I accidentally rsync-ed to a server using the delete attribute when I shouldn't have.
Is there any chance of getting the data on the server that rsync removed.. back?
0
votes
2answers
121 views
Redirecting stdin with stdout to file
So I have a program that takes in user input and outputs text based on the input.
EDIT2: I want to create a script that runs a C executable and the script feeds the C program input from a file and ...
1
vote
1answer
56 views
Standard I/O File Descriptors
I am new to Shell SCripting
I code this
$ ls -l 1> stdout.txt
and I get the output as desired,
1> stdout.txt
redirects the output from standard output to the file stdout.txt.
I don't ...
3
votes
2answers
56 views
Search by file dimension [duplicate]
I have many photos. How to search files by its dimensions? For example, i want to search images with exact dimensions 500 x 500 pixels. Is there any utility for this task?
5
votes
1answer
381 views
Immutable bit on AIX?
Under Linux I can:
chattr +i SOMEFILE
so that even root can't modify the SOMEFILE. Are there any similar solutions for AIX?
13
votes
2answers
8k views
How do I do a ls and then sort the results by date created?
In what order are the dated ordered by? Certainly not alphanumeric order.
ls -lt sorts by modification time. But I need creation time.
1
vote
2answers
145 views
Any programs suitable for making a database over disk-content?
I have quite a lot of external hard-drives, and often have a hard time finding what I'm looking for - not to mention not storing the same file several times on different drives or finding free space ...
3
votes
2answers
172 views
rm -fr not working
I have a directory that was generated by mistake by an application and this directory has a structure that involves more than 2000 directories, one inside a another, something like:
Directory aaaa ...
1
vote
2answers
28 views
Single process accessible temporary file
I want to create a file that is only accessible to the process that created it (and potentially its children), and that disappears when the process exits, ideally never persisting the file to disk. As ...
4
votes
2answers
69 views
How to upgrade shared library without crash?
Here it says that you can rewrite an executable file and the process will run just fine - it will be re-read when a process restarts.
However, when I try to replace a binary file while the process is ...
0
votes
3answers
63 views
how to delete temp and log files with terminal on vps?
I'm kinda pretty new to this but anyone know how to delete any temp and log files or these kind of files on vps with terminal? I'm runnin debian on the vps. I'm troubled since I can't locate those ...
27
votes
5answers
15k views
What is a Superblock, Inode, Dentry and a File?
From the article Anatomy of Linux File Systems by Tim Jones, I read that Linux views all the file systems from the perspective of a common set of objects and these objects are superblock, inode, ...
2
votes
2answers
76 views
How does Linux know the Location of File Data on Disk
related to: What is a Superblock, Inode, Dentry and a File?
None of the famous metadata structures hold onto to location data for the actual file. Dentry maps names to inodes, and inodes store ...
0
votes
1answer
49 views
LINUX: Permissions for files: Identify if it is a file or directory, and its access allowed to the world, user, and group [duplicate]
I am having trouble understanding permissions for directories and files in LINUX.
By examining permissions for each of the following files, identify if it is a file or directory, and describe the ...
6
votes
1answer
113 views
find is missing a result — how is that possible?
What conditions explain this output:
root@ip:/# find / -name "server.xml" -print
/etc/tomcat7/server.xml
root@ip:/# ls /var/lib/tomcat7/conf/server.xml
/var/lib/tomcat7/conf/server.xml
I am ...
6
votes
1answer
241 views
Stacked filesystems with write-back
I need to setup a system where a laptop and a desktop computers coexist.
The idea is, I bring the laptop into the network and the laptop syncs the /home directory( with some exceptions) with the ...
5
votes
7answers
816 views
Bash, remove oldest files
I`m trying to delete old files from directory and leave only 3 newest files.
cd /home/user1/test
while [ `ls -lAR | grep ^- | wc -l` < 3 ] ; do
rm `ls -t1 /home/user/test | tail -1`
...
4
votes
1answer
106 views
emblem for pdf created by libreoffice
If I create a test pdf file in a directory, by using something like
ls -al > testpdf.pdf
the file is shown in Caja 1.4.0 with an understandable emblem that is 'acrobat-like'.
If I create a ...
6
votes
4answers
222 views
How do I stop the root user from deleting a file?
I'd like to know if I can prevent the root user from deleting a file.
Is it possible?


