Questions tagged [write]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
35 views

Circular pipe situation

More of an academic/theory question - say I have process A piping into process B: A | B normally, the way pipes are designed, is if process A dies, the pipeline will gracefully shutdown. However, if ...
Alexander Mills's user avatar
0 votes
0 answers
39 views

what size does stat return while write?

On Linux, suppose I do a write() to end of a file, and while this is still completing, from another thread I do a stat-type call on that file (such as fstat() or lstat()). I would expect, that the ...
Mark Galeck's user avatar
0 votes
1 answer
189 views

Does write(fd with O_SYNC) only flush data of THAT fd instead of all caches caused by other fds of same file?

I was using dd command to change a single byte of a block device(not the partition block device), such as /dev/nvme0n1, at a specific position (not managed by normal file). dd of=${DEV:?DEV} seek=${...
osexp2000's user avatar
  • 472
0 votes
1 answer
90 views

Does the echo command create a swap file when it writes a line to a file?

I am currently working on a personal project, and I would like to simply record logs in the following way using the echo command. My question is if the echo command accesses the same file at the same ...
JongSun Park's user avatar
1 vote
1 answer
181 views

Does rm -rf /mnt/ delete files in subfolders if you do not have write access to /mnt/?

I accidentally ended up with rm -rf some-text-folder-I-had-already-deleted-previously.txt /mnt/ because of arrow up into bash history. My screen flashed with lots of subfolders that I actually do have ...
jmkane's user avatar
  • 111
0 votes
1 answer
111 views

How does the Kernel implement synchronisation techniques on file access

I've read that the kernel implements synchronisation mechanisms when accessing files. For example, if we try and write or read to a file in the file system using read() or write() from different ...
Engineer999's user avatar
  • 1,121
0 votes
1 answer
95 views

Capture incoming terminal messages (write/mesg)

write allows sending messages to connected users terminal. $ echo "hello budy" | write budy This can become quite annoying when messages interfere with a terminal operation. A drastic ...
Jav's user avatar
  • 960
0 votes
1 answer
141 views

How `stdio` recognizes whether the output is redirected to the terminal or a disk file? [duplicate]

#include <stdio.h> #include <unistd.h> int main(void) { printf("If I had more time, \n"); write(STDOUT_FILENO, "I would have written you a shorter letter.\n", 43); ...
arka's user avatar
  • 203
1 vote
2 answers
275 views

Is there a way to force the write command to block until all bytes have been written?

Per the man pages, the write command "writes up to count bytes" and then returns the actual number of bytes written. Thus if I wanted to ensure all bytes were written to the file descriptor, ...
Izzo's user avatar
  • 1,019
3 votes
0 answers
48 views

Minimizing disk usage with parallel calls to GCC

I am experimenting with testing GCC in parallel. My setup will run 96 tests before giving me the test report. If I run these tests sequentially it will invoke GCC once, run the executable, gather ...
Rewbert's user avatar
  • 131
0 votes
1 answer
38 views

Unable to write to root from regular user

I'm doing some exercises from a RHEL 8 book and I need to write to root from a regular user. I'm using RHEL VMs with VirtualBox and Windows 10 as host. I'm logged in as root, and I have two terminals ...
frank din's user avatar
2 votes
1 answer
893 views

What will happen to the rest of the file if write() is interrupted by a power cut?

I am calling write(fd, buf, N) on a normal file descriptor. The file pointer before calling is not at the beginning or end but instead somewhere in the middle of the file. The call is than interrupted ...
zomega's user avatar
  • 938
1 vote
2 answers
3k views

Write two variables in a two-column file (tab-separated)

Hello GNU/Linux newbie here. I want to write two variables in a two-columns tab-separated file. In my code, the variables are $sample_name and $file. I use the commands: touch to create the file and ...
Rea Kalampaliki's user avatar
0 votes
1 answer
104 views

Are there specific folders in the file system that cannot be written to?

Leaving aside the need for that, I wanted to write (create a file) into /sys/devices/pci0000:00/{one-of-the-devices}/. Running touch a returns touch: cannot touch 'a': Permission denied. (I read ...
Veverke's user avatar
  • 348
0 votes
1 answer
73 views

tcpdump isn't storing packets to file upon power loss

I'm working on a pi device that I can plug into the network and it will automatically start packet capturing to a rotating file. The idea behind the device is that when one of my clients is having a ...
Stephen Remich's user avatar
0 votes
1 answer
34 views

Appending data to a text file beyond cat [closed]

cat is a convenient way to append data to a text file. Could I do better?
Vera's user avatar
  • 1,193
0 votes
1 answer
561 views

Password protection for a file for 'write'

My requirement is to to protect a file with password. The user should be able to write/edit the file only after password authentication. But the user should be able to read the file without password ...
Guest's user avatar
  • 1
0 votes
1 answer
799 views

Mounted hdd drive all of a sudden will not allow writing

I have a system with TVHeadend installed on Ubuntu for 4 years and it worked perfect with recording shows and rewind live tv. But all of a sudden, when I try to record shows, the shows are not ...
ejohalj's user avatar
0 votes
0 answers
108 views

How can I monitor whether disk activity is sychronous or asynchronous?

My Google-fu simply cannot find an answer to this. If I have a process with heavy I/O activity, how can I check whether it's using asynchronous or synchronous writes? (I want this information to ...
sssheridan's user avatar
1 vote
0 answers
416 views

Can't create /etc/passwd.xxx file but can create /etc/test file in centos

I'm using an AWS image that for some reason is configured such that I can't seem to create any file named /etc/passwd.xxx (insert anything for the x). I can create files named test, test.xxx etc, it ...
dsollen's user avatar
  • 794
1 vote
1 answer
448 views

Can't write anything to USB drive. HTOP says 'disk sleep (uninterruptible)'

I was trying to 'burn' a ISO to my usb flash drive using the good ol' dd if=some-linux-distro.iso of=/dev/sdb bs=4M && sync but the process took a long time. So, I looked at the process in ...
sigsegv's user avatar
  • 149
0 votes
1 answer
1k views

Background flushing of kernel buffers

My Ubuntu Xenial system is as follows: # uname -r 4.4.0-179-generic # I have the following simple C code which writes 5 bytes to a file every second, for a total of 5 times: { int fd = open("...
Wad's user avatar
  • 163
2 votes
0 answers
196 views

ACL to change Read Write permissions of another User's files

Is there a way that sysadmin can create an ACL(ex: read_write_acl) so that all users which are assigned "read_write_acl" can modify the file permissions (only read and write) for the files ...
Jolly J's user avatar
  • 73
3 votes
2 answers
484 views

How do I feed data to a pipe until it's full, no more no less?

I want to use pipes on Linux as a synchronization primitive between a master process and a slave process. The classic way is to create two pipes, but I believe there's a way to use a single fd instead....
Alisa Sireneva's user avatar
0 votes
1 answer
95 views

Write all numbers between 0 and large number (both inclusive) to a file in random order

For simulation I am trying to do, I want a text file with numbers ranging from 0 to 2^33 which is a huge number. I have used this command: seq 0 Number >> OUTPUT FILE But this is very slow. ...
Uday's user avatar
  • 101
2 votes
2 answers
282 views

How can I simulate an unresponsive file descriptor?

We have an application that writes to a log file. In the prod environment, the log file directory is mapped to a NAS: 192.168.1.10:/storage/app/log 2554360832 11844608 2412762112 1% /usr/local/app/...
pacoverflow's user avatar
1 vote
0 answers
513 views

Alternatives to dd to read/write to a disk?

I'm using cp to read/write from an SSD drive but is not fast enough. Then I used dd, which is fast, especially with the drive unpartitioned. But I ran into errors like there is no space left on ...
Joan's user avatar
  • 119
0 votes
1 answer
1k views

What is a replacement for devmem write in a bash script?

I can use the dd command to read a memory address (ex: 0x400): dd if=/dev/mem count=4 bs=1 skip=$(( 0x400 )) But how would I write a value to physical address (ex: 0x400)? I tried this: function ...
Rich Brandt's user avatar
5 votes
1 answer
13k views

Why rm gives warning when deleting a write protected file?

I have a regular file and I changed its permission to 444. I understand that as the file is write protected, we can't modify or remove the contents of file but when I try to remove this file using rm, ...
LocalHost's user avatar
  • 489
-1 votes
1 answer
46 views

Why does the write speed keep changing, on a msdos file-system on toshiba 64Gb USB flashdrive

I have just bought a new 64gb toshiba 2.0usb flashdrive and put 13gb on it that took about 1 1/2 hours to transfer (max). But it started out saying about 7/8mb transfer and went to 1.3mb transfer, ...
dai's user avatar
  • 121
0 votes
2 answers
873 views

Can superuser write a file having 000 access permissions?

I know that a root user can read a file even if the access permissions are all set to 0 but i don't understand about the write and execute permissions in specific. Can a superuser write and execute a ...
LocalHost's user avatar
  • 489
0 votes
1 answer
160 views

Notification 'Message Sent' for write command

I need to use the write command to send someone a message. Using a shell script if the message is sent successfully I want to have a 'Message sent!' notification pop up and if possible, end the shell ...
Γιάννης Κόντης's user avatar
0 votes
1 answer
492 views

How can I estimate the whole time of a write process including sync?

Progress and estimated time to write without and with sync I have found no tool (or straightforward method) that will include flushing the buffers when showing the progress and estimating the ...
sudodus's user avatar
  • 6,291
1 vote
0 answers
226 views

consistent writes to a file while preserving its inode

What is the best way to edit a file consistently (consistency used here in the database systems sense of the term) without changing its inode? Normally, I would write to a temporary file and then ...
user001's user avatar
  • 3,638
1 vote
1 answer
121 views

write in file starting from certain line

I have a file which looks like this: ********************************** Some notes are here Year Month Day Hour Minute Second . . . . . . . . . . . . . . . . . Undertneath this, I would like to have ...
Jellyse's user avatar
  • 223
2 votes
1 answer
304 views

Why does terminal takes input line by line?

If I use: strace echo 'a b c' > file The bottom lines are: write(1, "a\nb\nc\nd\n", 8) = 8 but in strace echo 'a b c d' > /dev/pts/0 These lines are: write(1, "a\n", 2) ...
Prvt_Yadav's user avatar
  • 5,792
0 votes
2 answers
102 views

Save in a file first 7 file in the directory /bin that starts with c

I have write a command in the shell of linux to count the file (in total 8) starting with 'c'in the directory /bin find /bin/[c]* -type f | wc -l What I wish to do now, it's save the name of the ...
Gianni Spear's user avatar
0 votes
2 answers
79 views

Write command working one way?

I want to communicate with my girlfriend through the write command. She's on a mac, I am on a debian laptop. I did the next steps: adduser haly apt-get install openssh-server systemctl start ssh ...
murpholinox's user avatar
8 votes
3 answers
6k views

How can I output a command to a file, without getting a blank file on error?

I'm trying to run a command, write that to a file, and then I'm using that file for something else. The gist of what I need is: myAPICommand.exe parameters > myFile.txt The problem is that ...
goodguy5's user avatar
  • 194
6 votes
1 answer
1k views

Atomically write a file without changing inodes (preserve hard link)

The normal way to safely, atomically write a file X on Unix is: Write the new file contents to a temporary file Y. rename(2) Y to X In two steps it appears that we have done nothing but change X "...
cat's user avatar
  • 3,448
1 vote
1 answer
4k views

is `write()` asynchronous write?

From Operating System Concepts Another issue that can affect the performance of I/O is whether writes to the file system occur synchronously or asynchronously. Synchronous writes occur in ...
Tim's user avatar
  • 100k
1 vote
1 answer
210 views

Prevent Linux from writing to HDD

I have 3 HDD's, I want to install Linux Mint on HDD 3 which is currently empty and I don't want Linux to be able to write any data on the other 2 which is where all my Windows files are, is there a ...
Bichard 's user avatar
0 votes
1 answer
84 views

Why is my very old USB2 Harddisk faster than expected?

http://web1.heissa.de/usb2_speed.pdf From the spec, I would expect a max. write rate of 60 Mbyte/s. But today a simple test told me it‘s 226 MB/s. Is it possible that this is a trick of kernel 4,18 ...
Schorsch Zwanglos's user avatar
0 votes
2 answers
434 views

Split datetime column in csv file into MM/YYYY and time column separately and write to the same csv

I am trying to use awk, split and then print but running into error Input: id day userId itemId 1 12/1/17 8:32 2232 tv 2 1/12/18 10:18 3232 fdfs 3 2/9/18 10:50 232 fdsf ...
thinkingsavvy's user avatar
1 vote
1 answer
4k views

Knowing when a write() on a serial port has finished transmitting data

I need to synchronize an IO pin value with a write to a serial port from user space (because I wasn't yet able to do it from kernel space - see my other question). My code (leaving out error checking) ...
user907323's user avatar
1 vote
2 answers
397 views

Can we use read(), write() on a directory in unix/linux?

Can we use read(), write() on a directory just like on any other file in Unix/Linux? I have a confusion here because directories are also considered as files.
Nht_e0's user avatar
  • 43
3 votes
1 answer
2k views

How to use write command to send message to user in debian stretch

who command show that xyz user is on tty2. $ who xyz tty2 2018-06-22 08:18 (:0) I trying send message to xyz using write xyz command. But it does not shows on terminal. When I run tty ...
Heir Of Knowledge's user avatar
2 votes
1 answer
144 views

Prevent battery drain from constant write IO churn by browsers

For some reason, common browsers (Chromium is particularly bad, but Firefox isn't much better) generate constant IO load, particularly writes, on my Debian system. This is the case even when the ...
Alex's user avatar
  • 39
1 vote
1 answer
977 views

Simulating slow down of disk operations

we know that there exist some excellent tool like netem which make it possible to slow down network parameters (like bandtwidth and so on). Is there exists analogous tool for simulating slow down ...
newbie's user avatar
  • 131
0 votes
1 answer
123 views

Can reading STDIN conflict many writings from different processes? [closed]

One of my applications (Let's say "A") pushes its some alerts into STDIN and that app's shell script reads that STDIN and processes it. In the same way, there can be another applications (called B, C, ...
Débora's user avatar
  • 151