Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm trying to remeove the first 8 bytes from binary file using the command:
dd if=new.pdf of=new2.pdf ibs=1 skip=8
but it's taking too long.
Is there a way to remove the first 8 bytes, in a faster way ?
ibs=1 is requesting dd to read one single byte at a time. It's going to be slow - for each byte, there is a context switch to the kernel.
I would:
tail -c+9 new.pdf > new2.pdf
I think you could use dd, choose the best block size for your specific environment, and... skip the bytes:
dd if=new.pdf of=new2.pdf bs=4M iflag=skip_bytes skip=8
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
The top command is live and constantly updating, not generating a permanent result. Can we add an argument for a permanent result (if it exists), or use a different command resulting in a definite and final response?
top -n1
should do the job. If you want to store the output in a file, you should add the -b option for batch mode.
Note that this is just a sample of usage at one time, not anything like a final answers as all the numbers in top vary over time even on the stablest of systems.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have a problem using dd command, assume that I am writing 20MB file to 100MB partition. After the write I am not able to access the rest of 80MB.
dd if=temp_file of=/dev/sdb1
Is there a way I can specify dd to adjust to the file system that I am writing into?
All I am interested is know if there is a way to use the 80MB space without disturbing the initial 20MB.
By using the dd command the way you do, you overwrite the file-system data, including the important meta-data about the file-system. If the temp_file contains a file-system for a 20MB partition then that's what you will get.
If you want a 100MB partition, you need to create a 100MB disk-image to write to the disk.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have 6 very big directorys and once a day I would like to check size each of this directories for my monitoring. Now I'm using du -s command but it take many time and significantly slows my server. Is any different better way to do this?
Depending on circumstances you could put those directories on seperate partitions, the "used" size of which you can check very quickly with df.
This, of course, means that the directories are limited to the size of their respective partitions, which could be a pain. Hence the "depending on circumstances".
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
By safety I mean if the transfer gets interrupted, how does that impact the data in both source and dest? Is it also dependent on the specific types of filesystems?
When working across filesystems mv really has no choice but copying the file, in effect doing whatever cp does and then unlinking the original file.
A simple strace shows this:
rename("/tmp/file.rand", "./file.rand") = -1 EXDEV (Invalid cross-device link)
^^^^^^^^^^^^^^^^^^^
After this point mv reads 65536 bytes at a time from one fd and writes them to the other and does an unlinkat at the end.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Recently i installed Ubuntu 13.04 and allocated 20 GB for it. The system got installed space less than 10 GB. Now, can i shrink it to 10 GB without formatting it?
Thats to say, i don't want to have large empty space in the partition.
You could use the resize2fs command.
However, I would suggest to backup the most important files (on e.g. an USB key) before doing that (e.g. /etc/ and some of /home/ )
See also this question...
BTW, 20GB for the system partition is not that much.....