Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

New answers tagged

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 ...
user avatar
  • 268k
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.
user avatar
  • 862
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'
user avatar
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
user avatar
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) ...
user avatar
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 ...
user avatar
  • 1,208
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 ...
user avatar
  • 67.1k
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 ...
user avatar
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 ...
user avatar
  • 1
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
user avatar
  • 1
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, ...
user avatar
  • 2,661
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 ...
user avatar
  • 6,425
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]$ ...
user avatar
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 ...
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, ...
user avatar
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 ...
user avatar
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 ...
user avatar
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 ...
user avatar

Top 50 recent answers are included