How to overwrite a file with shell script without using extra device space?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm trying to overwrite a file using:
cp source.txt target.txt
But I get "No space left on device".
I also tried using dd with no success, even with super user.
How can I overwrite using only the space used by the target file?
shell-script file-copy
add a comment |Â
up vote
0
down vote
favorite
I'm trying to overwrite a file using:
cp source.txt target.txt
But I get "No space left on device".
I also tried using dd with no success, even with super user.
How can I overwrite using only the space used by the target file?
shell-script file-copy
Is source larger than target?
â Jeff Schaller
Aug 30 at 23:46
Did you usedd ⦠>â ordd ⦠of=?
â G-Man
Aug 31 at 0:02
What operating system is this? What filesystem? The reasons for getting that issue may very well depend on those.
â ilkkachu
Sep 1 at 19:44
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to overwrite a file using:
cp source.txt target.txt
But I get "No space left on device".
I also tried using dd with no success, even with super user.
How can I overwrite using only the space used by the target file?
shell-script file-copy
I'm trying to overwrite a file using:
cp source.txt target.txt
But I get "No space left on device".
I also tried using dd with no success, even with super user.
How can I overwrite using only the space used by the target file?
shell-script file-copy
shell-script file-copy
asked Aug 30 at 23:12
DeniseJF
1
1
Is source larger than target?
â Jeff Schaller
Aug 30 at 23:46
Did you usedd ⦠>â ordd ⦠of=?
â G-Man
Aug 31 at 0:02
What operating system is this? What filesystem? The reasons for getting that issue may very well depend on those.
â ilkkachu
Sep 1 at 19:44
add a comment |Â
Is source larger than target?
â Jeff Schaller
Aug 30 at 23:46
Did you usedd ⦠>â ordd ⦠of=?
â G-Man
Aug 31 at 0:02
What operating system is this? What filesystem? The reasons for getting that issue may very well depend on those.
â ilkkachu
Sep 1 at 19:44
Is source larger than target?
â Jeff Schaller
Aug 30 at 23:46
Is source larger than target?
â Jeff Schaller
Aug 30 at 23:46
Did you use
dd ⦠>â or dd ⦠of=?â G-Man
Aug 31 at 0:02
Did you use
dd ⦠>â or dd ⦠of=?â G-Man
Aug 31 at 0:02
What operating system is this? What filesystem? The reasons for getting that issue may very well depend on those.
â ilkkachu
Sep 1 at 19:44
What operating system is this? What filesystem? The reasons for getting that issue may very well depend on those.
â ilkkachu
Sep 1 at 19:44
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
If you have it installed:
$ truncate -s 0 target.txt
Will reduce the file size to zero.
And, maybe:
$ : > target.txt
But perhaps it is a problem with the journal being unable to write to disk. In that case, you need to log in as root to remove some files.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
If you have it installed:
$ truncate -s 0 target.txt
Will reduce the file size to zero.
And, maybe:
$ : > target.txt
But perhaps it is a problem with the journal being unable to write to disk. In that case, you need to log in as root to remove some files.
add a comment |Â
up vote
0
down vote
If you have it installed:
$ truncate -s 0 target.txt
Will reduce the file size to zero.
And, maybe:
$ : > target.txt
But perhaps it is a problem with the journal being unable to write to disk. In that case, you need to log in as root to remove some files.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
If you have it installed:
$ truncate -s 0 target.txt
Will reduce the file size to zero.
And, maybe:
$ : > target.txt
But perhaps it is a problem with the journal being unable to write to disk. In that case, you need to log in as root to remove some files.
If you have it installed:
$ truncate -s 0 target.txt
Will reduce the file size to zero.
And, maybe:
$ : > target.txt
But perhaps it is a problem with the journal being unable to write to disk. In that case, you need to log in as root to remove some files.
edited Sep 1 at 19:26
answered Aug 31 at 0:35
Isaac
7,18111035
7,18111035
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465872%2fhow-to-overwrite-a-file-with-shell-script-without-using-extra-device-space%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Is source larger than target?
â Jeff Schaller
Aug 30 at 23:46
Did you use
dd ⦠>â ordd ⦠of=?â G-Man
Aug 31 at 0:02
What operating system is this? What filesystem? The reasons for getting that issue may very well depend on those.
â ilkkachu
Sep 1 at 19:44