2022 Developer Survey is open! Take survey.

Questions tagged [write]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
294 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 ...
user avatar
  • 321
0 votes
2 answers
376 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 ...
user avatar
0 votes
0 answers
19 views

linux notification of disk write

In linux, during normal (buffered) writes, the data first goes to page cache and then goes to disk at a later point in time. so for example, when write() returns, we know that data is in page_cache. ...
user avatar
  • 101
0 votes
1 answer
39 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 ...
user avatar
  • 298
0 votes
1 answer
31 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 ...
user avatar
0 votes
1 answer
33 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?
user avatar
  • 53
0 votes
1 answer
90 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 ...
user avatar
  • 1
0 votes
1 answer
369 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 ...
user avatar
0 votes
0 answers
47 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 ...
user avatar
0 votes
0 answers
90 views

How to configure samba for a shared folder for 2 groups, each with write and read access on all files [closed]

I need to create a samba shared folder, 2 users must have access this folder with write and read capabilities on all files, they should be able to modify and read each others files on the full ...
user avatar
1 vote
0 answers
147 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 ...
user avatar
  • 784
0 votes
0 answers
164 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 ...
user avatar
  • 129
0 votes
1 answer
394 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("...
user avatar
  • 153
1 vote
0 answers
92 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 ...
user avatar
  • 63
3 votes
2 answers
249 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....
user avatar
  • 41
0 votes
1 answer
68 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. ...
user avatar
  • 101
2 votes
2 answers
160 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/...
user avatar
1 vote
0 answers
261 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 ...
user avatar
  • 119
0 votes
1 answer
688 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 ...
user avatar
3 votes
1 answer
7k 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, ...
user avatar
  • 409
-1 votes
1 answer
45 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, ...
user avatar
  • 121
0 votes
2 answers
418 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 ...
user avatar
  • 409
0 votes
1 answer
86 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 ...
user avatar
0 votes
1 answer
163 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 ...
user avatar
  • 4,587
1 vote
0 answers
174 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 ...
user avatar
  • 3,530
1 vote
1 answer
64 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 ...
user avatar
  • 223
2 votes
1 answer
214 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) ...
user avatar
  • 5,410
0 votes
2 answers
101 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 ...
user avatar
0 votes
2 answers
65 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 ...
user avatar
8 votes
3 answers
4k 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 ...
user avatar
  • 194
5 votes
1 answer
794 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 "...
user avatar
  • 3,270
1 vote
1 answer
3k 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 ...
user avatar
  • 89.8k
1 vote
1 answer
111 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 ...
user avatar
0 votes
1 answer
83 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 ...
user avatar
0 votes
2 answers
333 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 ...
user avatar
1 vote
1 answer
2k 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) ...
user avatar
1 vote
2 answers
117 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.
user avatar
  • 43
2 votes
1 answer
1k 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 ...
user avatar
2 votes
1 answer
127 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 ...
user avatar
  • 39
1 vote
1 answer
764 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 ...
user avatar
  • 121
0 votes
1 answer
89 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, ...
user avatar
  • 151
0 votes
1 answer
421 views

Output to multiple files in crontab

In crontab I have set up a python script to run every 5 min, and output to a specific file */5 * * * * sudo /home/pi/MyProgram.py -o /home/pi/MyFile.csv How can I take the same ...
user avatar
  • 107
1 vote
1 answer
4k views

How to block messages from write?

I have an ssh account on a server. Someone is spamming me with write messages. So I can't run any command in an interactive login. Is there anyway I can prevent them from sending me write messages or ...
user avatar
4 votes
1 answer
693 views

How to force Fedora 27 to write to USB flash drive immediately?

My Fedora 27 writes actual data to USB on umount. Before umount it works only with links or something like that. So, for example, when I transfer a big file of 5 GB cp /home/iam/bigFile /run/mnt/iam/...
user avatar
  • 779
7 votes
4 answers
3k views

Overwriting a running executable or .so

I have a question about overwriting a running executable, or overwriting a shared library (.so) file that's in use by one or more running programs. Back in the day, for the obvious reasons, ...
user avatar
4 votes
1 answer
3k views

Linux USB Flash direct write / write cache

Lately I've been using USB2 flash drives to transfer a lot of data to my company. When copying the Data to the flash drive, I noticed that the data is not written directly to the drive. It wrote ...
user avatar
0 votes
1 answer
108 views

Why is the write rate to the disk being up to several GB/s, while no process reports any writing?

I use Ubuntu 17.04, though this problem was persistent in many previous versions. Long ago (a year or two, I think) I started to spot it. Immediately (no more than a couple of minutes) after the ...
user avatar
-3 votes
1 answer
132 views

write/wall: how to prevent non-printable characters from being escaped [closed]

Compare dd if=/dev/urandom bs=512 count=4 to write lsr < <(dd if=/dev/urandom bs=512 count=4) How do I achieve the intended behaviour? Current output: Message from qwe@hhgw11 on pts/386 at ...
user avatar
1 vote
0 answers
184 views

Relation between write and filesystem blocksize in SSD disks on Apple

R. Stevens, in his famous book about programming in O.S. environment, taught us that when the syscall write's block size is comparable (or even equal) to the filesystem block size, the performances ...
user avatar
-5 votes
1 answer
88 views

Write xommand in Solaris, Unix

Hey guys need a little help here. For example me and my buddies are sending messages on our school computers using write user* pts/** , my question is can the system administrator see on his pc that ...
user avatar
  • 1