All Questions

Tagged with
Filter by
Sorted by
Tagged with
1
vote
1answer
26 views

Removing directories not accessed in X days

I have written some scripts for downloading and caching music, and I like to delete the directories in the cache location that have not been accessed in X days. I can do that via: gfind "$music_dir" ...
0
votes
2answers
45 views

add / at the end of each line

I want to add this character at the end of each line in a file: sed -e 's/$/\/$/g' myfile.txt > myfile_new.txt The result add $/ with explicit $ in each line. but I do not want to add $. For ...
0
votes
0answers
15 views

How to know the download date of a zip folder

I downloaded a zip file which contains a .csv file (DOS format, i.e. I needed to convert it using dos2unix). I need to check the data (at least the day/month/year) which I downloaded the file in. ...
-4
votes
2answers
48 views

Forgot to put a slash before download path, where were these files downloaded to?

I forgot to put a slash before my home folder when downloading some files and it seems that they downloaded successfully but I can't seem to navigate before / within my thunar explorer so I can't get ...
1
vote
1answer
26 views

A simple way to update the access time of multiple files

I have a folder with several sub-folders and files. I work on a server where any files that are older than 60 days are automatically deleted. What are some simple commands to update the access time (...
2
votes
1answer
46 views

Annotating any files

I have had this problem for a very long time, had several discussions with friends, and tried searching relating info online. All efforts were in vain so I decide to give a shot here. I have lots of ...
2
votes
1answer
64 views

Why can't I access a symlinked directory

I want to (soft)link my .thunderbird dir onto the actual directory which is on a SD card. Thus, (xenial)florian@localhost:~$ ls -la /var/host/media/removable/SD\ Card/.thunderbird/ total 24 drwx-----...
2
votes
0answers
39 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 ...
4
votes
2answers
451 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 ...
2
votes
1answer
33 views

“File” backed by running program?

My clients have many programs that read and write files of a certain format. They do it by sending regular old system calls, so libraries like gio aren't (in the general case) involved. I would like ...
0
votes
1answer
18 views

After re-connecting hard disk, terminal commands stop working

The current working directors is, e.g. /media/username/ExtHDD/. When disconnecting and re-connecting that HDD, commands such as ls do not work properly anymore. $ -????????? ? ? ? ? ...
3
votes
1answer
130 views

Some special files in Unix

Background There are lots types of special files in Unix, for example symlinks, device files and proc files (under /proc). /proc files are just normal files or even text files. But for the rest, I ...
5
votes
4answers
147 views

Protecting access to NFS shares in Docker

I would like people to access NFS shares from within Docker. Problem is inside of Docker they can become root, and then they can have write access to anyone's files by becoming that user. Is there a ...
0
votes
2answers
23 views

Navigate file easily in Linux GUI Apps?

This is not about File Manager as I can copy/paste or type the full path in the address bar. This question is about other apps, e.g. FeatherPad text editor. If you have a file buried deep within your ...
7
votes
1answer
537 views

Is there a Linux system call to create a “view” of a range of a file?

Does Linux provide a system call which can create a "view" of a limited byte range of a backing file? I'm envisioning something that for example would act on an open file descriptor and either modify ...
2
votes
2answers
66 views

Is it possible to detect file or folder creation/deletion in real time?

I want to monitor file or folder creation/deletion instantaneously, is it possible? EDIT:I am using Ubuntu 16.04
4
votes
1answer
53 views

Can we create soft links that concatenate multiple files? [duplicate]

Let's say that I have files f1, ..., f9. I want to create a single view -- or a soft link -- say f, that displays a concatenated view over the 9 files. For example, if I execute wc -l f the answer ...
9
votes
2answers
604 views

Do typical system call interfaces allow reducing the size of a file (without replacing it with a different inode)?

Is there a way to open() a file and cause it to shrink? One can, of course, open them in append-mode or seek to the end and write to cause them to grow. However, as far as I know, there is no method ...
0
votes
2answers
551 views

How should I merge two folders on the same filesystem?

I have two directories that look something like the following but with many more files. folder1/pic1.png folder1/test/readme.txt folder2/guest.html folder2/backup/notes.txt I want to "merge" these ...
0
votes
0answers
26 views

What are the contents in /sys/block when ubuntu is a virtual machine?

I am very confused to how /dev/dm-1 was being used as a swapspace by my Ubuntu guest Virtualbox VM. gparted doesn't show these drives. What is going on here? How does the same drive dm-1 have ...
0
votes
3answers
75 views

Demonstrate file encoding

I am developing some training and would like to demonstrate file encoding. What I am trying to accomplish is create a text file with one type of encoding that show up as nonsense when read by Linux. ...
0
votes
1answer
99 views

Does constant writing to “files” in `/proc` or `/sys` reduce the life of my SSD due to its limited number of writing cycles?

My laptop has a SSD drive and I run a script which writes every other second to /sys/class/thermal/cooling_device4/cur_state. I don't think this would count as writing to the SSD and thus reducing its ...
24
votes
2answers
4k views

Purpose of cp -x (stay on file system)?

If I wanted to stay on the same file system, couldn't I just specify an output path for the same file system? Or is it to prevent accidentally leaving the current file system?
1
vote
0answers
17 views

How to see the file revisions in Tux3 and NILFS?

Tux3 and NilFS are file systems made for file history/revisions. How can I see these revisions? On Windows, there is a file history manager and Shadow Copies (enabled by default only on Windows 7 ...
0
votes
0answers
17 views

How to delete backed files only from original storage device?

I have a backup of an SD card but have not yet deleted the original files to free up space. Now, they got mixed up with new files. How do I delete all files that are already backed up (same file name ...
3
votes
1answer
64 views

Page cache behavior guarantees and log files

Are there any guarantees as to when and in what order dirty pages are written out to disk? In the specific case of log structured files (files that are only ever appended to), is it possible for dirty ...
1
vote
1answer
63 views

How to use ext4 inline_data to store empty directories?

How can I use ext4's inline_data feature to store empty directories? It seems like inline_data works only with small files, or the directories store a lot of data.
2
votes
0answers
74 views

Do the filesystem under Linux enforce serialization, which means only one change to the filesystem actually happens at any given time?

https://unix.stackexchange.com/a/12818/674 says Lock files are used by programs to ensure two (well-behaved) separate instances of a program, which may be running concurrently on one system, ...
1
vote
2answers
114 views

What are two caveats of line buffering in Unix?

A paragraph from APUE Chapter 5.4 about line buffer: Line buffered. In this case, the standard I/O library performs I/O when a newline character is encountered on input or output. This allows us ...
1
vote
1answer
229 views

Filesystem design: necessity of inode number and table [closed]

The *nix filesystems maintain an inode table at the beginning of the disk (or at some fixed location). It is indexed by the inode number, which is an integer that uniquely identifies an inode. Knowing ...
1
vote
1answer
36 views

How to safely move a directory to a different partition?

My / partition keeps filling up. To mitigate this, I'd like to move /opt to a different directory, /usr/local/foo, which is mounted to a different partition. How do I do this safely? If I simply move ...
22
votes
2answers
2k views

What happens when I kill 'cp'? Is it safe and does it have any consequences?

What are the consequences for a ext4 filesystem when I terminate a copying cp command by typing Ctrl + C while it is running? Does the filesystem get corrupted? Is the partition's space occupied by ...
5
votes
1answer
1k views

Obscure reasons a file is read-only?

The Linux filesystem seems to have layers and layers of subtlety that I stumble upon case-by-case: I'm interested in editing this file: [user@box ~]$ ls -l /a/b/c/foo.bar -rw-rwxr-x 1 user user ...
0
votes
1answer
364 views

Moving file with wildcard and add timestamp to the file name

I need to move a file to an archive folder, and add a timestamp in front of the file name. mv /dev/DataStage/myProject/source/TEST/MyFile_*.csv /dev/DataStage/myProject/Archive/TEST/MyFile_*.csv ...
0
votes
1answer
27 views

How can you replace a file on a raw device preserving filesystem integrity?

Say I have a Linux system and want to write to a raw device. But I want to replace a certain file on this device with a new version. Can this be accomplished? I think with dd you could maybe write the ...
1
vote
1answer
123 views

Strange permission denied error message

Here is what I'm trying to do (CentOS 7): root@serv02 # /usr/sbin/tcpdump -nn -i eno16780032 -s 0 udp port 53 -w /var/opt/A.pcap -C 100 -W 30 tcpdump: /var/opt/A.pcap00: Permission denied I'm ...
1
vote
1answer
1k views

How do I chmod or chown a file so that anybody in the world can access it? [duplicate]

.I have a font file which I created using a python script from Github. The owner and group are root. I don't actually know what this means... I can guess what owner means, and I can guess that a group ...
4
votes
0answers
76 views

no such file or directory trying to list or remove file in btrfs

I have a file system mounted btrfs. I have one directory in particular, that I can't remove, because it's listed as non-empty. In that directory, there's one file, which I can see the name of, but ...
4
votes
2answers
854 views

What are the final 3 bits in the UNIX permission mode bits?

I understand there are 12 permission bits of which there are 3 groups of 3 bits for each of user, group, and others, which are RWX respectively. RW are read and write, but for X is search for ...
1
vote
1answer
58 views

Why does it take longer to add new files to a directory that has a large number of files in it?

Back in 2011 we had a peculiar problem. We noticed that the processing tool for one of our clients was taking a long time processing ~20000 p/hr. Since we needed to process upwards 3 million files a ...
0
votes
1answer
24 views

search which other python files invoke a class defined in an given pythonfile

There is a set of python files in a folder. One file includes a class definition, for instance Class DataGen: How can I know which python file in this folder use this Class? Are there any linux ...
1
vote
1answer
33 views

How is file with continuously increasing size being copied

Let's imagine this situation: A file is being continuously appended by text in a while true loop with no sleep between iterations. while true do echo "foo" >> source.file done Another ...
1
vote
0answers
42 views

What happens in file system when we modify a part of a file and save it?

I know files are kept as chunks of blocks on disk or SD card. (SD card, being a block device, writes or reads in 512 Byte block. And file system itself manages with bigger size composed of those ...
1
vote
2answers
82 views

Why opening file for binary access is “meaningless” on Unix, nor the “+” for both read/write?

I am reading The C Programming Language (2nd Edition). On page 157 and 158 the author gives a code snippet of fopen in the Unix system. At the end of the snippet the author added: In particular, ...
0
votes
1answer
2k views

Inappropriate ioctl for device while reading flags on <file>

I am unable to set or view file attributes using lsattr and chattr commands on Reiser File System. Following result is observed: chattr +i Temp.txt chattr: Inappropriate ioctl for device while ...
9
votes
2answers
1k views

How is it possible 8 blocks get allocated but file size 0?

Someone ask me in other site about this question, i.e. a file named "abc.dat" has 0 file size but 8 blocks, and this is the output I ask him to give me (Some text has been translated from Chinese to ...
1
vote
2answers
792 views

What happens when we call rm filename.txt?

Inspired by this post, Do we get more disk space when we call rm insert_filename? The linked UNIX stackexchange post says: "the file gets unlinked. The data is still sitting there on disk, but the ...
0
votes
1answer
57 views

Can a directory tree be given “fixed”, unchangeable, permissions?

I'd like to set up shared directory trees where users can do full read-write and execute executables, and create and delete directories, and where all new files and directories created by anyone, ...
1
vote
1answer
375 views

setgid bit in umask of systemd service script

I have a downloader service running, and I'd like it to set the setgid bit of every directory it creates. Its already doing so, but I suspect that's because at the moment, the parent directory also ...
0
votes
0answers
41 views

Small files allocateing huge amout of disk space

I have a 20GB encrypted (VeraCrypt) container. On that container I'm storing small files. 200.000 files and the same amount of folders with an averrage filesize of maybe 10KB. Because the container ...