New answers tagged files
29
votes
Accepted
unable to delete file as root
The file has the i ("immutable") attribute, according to the output from lsattr that you show.
From the chattr(1) manual (on Ubuntu):
A file with the i attribute cannot be modified: it ...
0
votes
Copy a file with its parent dirs to a destination directory
It turns out cp --parents create parents even when source is a file.
1
vote
How to list files with only name and size
With zsh:
zmodload zsh/stat
stat -Ln +size -- *
With GNU find and sort:
LC_ALL=C find . -maxdepth 1 ! -name '.*' -printf '%f %s\0' |
sort -z |
tr '\0' '\n'
1
vote
How to list files with only name and size
This is a bit odd solution. You can use du command:
du -s *
will list size and name of files and directories
0
votes
Accepted
Can I copy a snapshot of a file that's being constantly modified?
Can Linux help me out here?
Yes. But not in the way you probably hoped it would.
So, file systems on Linux generally follow the semantics that a change to a file that is read (in whichever way) ...
1
vote
Can I copy a snapshot of a file that's being constantly modified?
You would need to pause the writing process before copying.
In majority of cases, the writer process will have some backup capability. Take a close look at the documentation of the process which ...
3
votes
Tried to open external harddrive img file
Use losetup to associate the image file with a free /dev/loopN device:
losetup -P -f /mnt/usb/vdisk1.img
This will report the name of the actual loop device used: if there are no other loop devices ...
1
vote
Tried to open external harddrive img file
Use losetup to create a loop device from the image
losetup -P -f /mnt/usb/vdisk1.img
the content of the image will be available as /dev/loopX, if the LVM structure on it isn't auto activated use vgs ...
0
votes
How to delete all duplicate hardlinks to a file?
To make a copy which has no hard links you could copy them to a different file system and then back again or just leave them on the other file system.
To the best of my knowledge hard links do not ...
0
votes
Simple, user-friendly GUI file finder?
Orange is a cross-platform lightweight file search tool that may be helpful to you.
Visit https://github.com/naaive/orange
4
votes
What will happen to the rest of the file if write() is interrupted by a power cut?
I see two different questions:
What happens if the power is cut in the middle of a write?
There is no guarantee what happens on a power cut -- you could even lose the entire filesystem.
However, ...
1
vote
Accepted
rsync include only subdirectory
In your first command, a/aa/*** would match aa/ and anything after that, but there is no match for a/, so nothing is copied.
In the second command, a/*** matches a/ and anything after that, so you ...
0
votes
Accepted
How to sync two folders with the same file names but different extensions
in general, if you have similar filename that changes in some particular place, you can set those differences in [] brackets:
ruslanas@ruslanas test]$ ls
a.jpg a.raw a.doc
[ruslanas@ruslanas test]$ ...
1
vote
One master ksh file to call 2 ksh script files
Take whatever you do to call the two scripts by hand from the command line: perhaps you cd to some directory; maybe you run ksh file1.ksh, or they are executable: /path/to/file1.ksh.
Copy those ...
Community wiki
0
votes
Remove null bytes from the end of a large file
Note that it's not because 3/4 of a filesystem is unallocated that the corresponding blocks of the underlying storage device will contain zeros. If some files were written before, but deleted since, ...
0
votes
Remove null bytes from the end of a large file
On Linux at least (and on filesystems that support it such as modern ext4), you can use fallocate -d to replace those sequence of zeros with holes that don't take up any disk space:
$ echo test > a
...
0
votes
Remove null bytes from the end of a large file
Preface
I just solved this problem myself with Python. It's simple in theory, but in practice, it actually requires quite a bit of code to do correctly. I wanted to share my work here so others don't ...
4
votes
Accepted
Why are .z.* files created for
These are left-overs from z, a fancy cd replacement. You might have this as an Oh My Zsh plugin. z maintains a ~/.z file, and the numbered versions are created when that file is updated; but they are ...
Top 50 recent answers are included
Related Tags
files × 4709linux × 753
bash × 497
shell-script × 479
permissions × 432
shell × 358
filesystems × 356
find × 337
directory × 276
command-line × 265
rename × 227
text-processing × 214
scripting × 168
timestamps × 158
rm × 145
ls × 144
awk × 143
grep × 121
filenames × 119
sed × 108
mv × 104
wildcards × 97
ubuntu × 93
date × 86
file-copy × 84