Questions tagged [tmp]
169 questions
315
votes
7 answers
How create a temporary file in shell script?
While running a script, I want to create a temporary file in /tmp directory.
After execution of that script, that will be cleaned by that script.
How to do that in shell script?
Bhuvanesh
- 3,285
- 3
- 12
- 7
188
votes
4 answers
What is the difference between /tmp and /var/tmp?
On most FHS systems, there is a /tmp folder as well as a /var/tmp folder. What is the functional difference between the two?
Wesley
- 13,963
- 12
- 35
- 49
119
votes
1 answer
What happens when you 'mount over' an existing folder with contents?
Right now /tmp has some temporary files in it. When I mount my hard drive (/dev/sdc1) on top of /tmp, I can see the files on the hard drive. What happens to the actual content of /tmp when my hard drive is mounted? Is it possible to perform r/w…
user
- 1,569
- 4
- 15
- 20
112
votes
3 answers
What are correct permissions for /tmp ? I unintentionally set it all public recursively
I have created a really really short life temporary directory that I wanted to share between some users for a few hours : /some/path/tmp
Unfortunately I have launched sudo chown 777 -R /tmp instead of sudo chown 777 -R tmp, so my /tmp file is now…
Stephane Rolland
- 4,147
- 6
- 37
- 49
90
votes
13 answers
Tab completion errors: bash: cannot create temp file for here-document: No space left on device
When using the tab bar, I keep getting this error:
bash: cannot create temp file for here-document: No space left on device"
Any ideas?
I have been doing some research, and many people talk about the /tmp file, which might be having some overflow.…
lucasrodesg
- 1,002
- 1
- 7
- 8
63
votes
3 answers
Finding the correct tmp dir on multiple platforms
I have a script that needs to create temporary files for its work, and clean up after itself. My question is about finding the right base directory for the temporary files.
The script needs to work on multiple platforms: Git Bash (Windows), Solaris,…
janos
- 11,171
- 3
- 35
- 53
47
votes
4 answers
How to make a temporary file in RAM?
I have a script that will pipe its output to |tee scriptnameYYMMDD.txt. After each cycle of the for loop in which the output is generated, I'll be reversing the file contents with tac scriptnameYYYYMMDD.txt > /var/www/html/logs/scriptname.txt so…
user208145
- 2,437
- 2
- 20
- 21
43
votes
3 answers
is /tmp guaranteed to exist?
Do I need to check & create /tmp before writing to a file inside of it?
Assume that no one has run sudo rm -rf /tmp because that's a very rare case
Ayush
- 4,567
- 2
- 14
- 10
33
votes
6 answers
Is it safe to rm -rf /tmp/*?
This is something I used to do a lot on Windows, but after my recent fiasco I want to make sure. Is it safe to do
sudo rm -rf /tmp/*
?
ripper234
- 31,063
- 43
- 82
- 90
28
votes
3 answers
Overflow /tmp mounted when there is free space on /
I recently faced an "overflow" issue on /tmp. I don't have a separate /tmp partition, and there is 17% free in / – then why did I get an overflow tmp filesystem?
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to…
Rahul Patil
- 24,281
- 25
- 80
- 96
27
votes
2 answers
I made a mistake last night, which deleted 1800GB of my File-Server unintentionally
I ran this command yesterday, I thought on a test machine, but it was a File-Server connected through SSH.
sudo rm -rf /tmp/* !(lost+found)
My terminal emulator is Konsole. My system is Debian 7.
Question:
Did this command delete other files than…
somethingSomething
- 5,721
- 18
- 58
- 98
22
votes
4 answers
How can I copy a /tmp/ directory that is created & deleted by a process?
I am investigating the behavior of a binary on Oracle Linux 9 (XFS filesystem). This binary, when called by a process, creates a directory under /tmp and copies some files to it. This directory gets a randomized name each time the process runs (a…
Artur Klemens
- 423
- 1
- 11
22
votes
1 answer
Can you remount /tmp partition to exec while live?
I have a server I need to re mount the /tmp partition to run exec.
The code I want to use is:
mount -o remount,exec /tmp
Run the program that needs it.
Than change it back.
mount -o remount,noexec /tmp
This is production server so I'm really…
Charles Yarbrough
- 335
- 1
- 2
- 7
19
votes
2 answers
How can I safely create and access temp files from shell scripts?
I've read that redirecting output to a fixed name file in /tmp can be a security risk, because if an attacker (or malcontent) notices that a file /tmp/tmpfileformyscript.tmp is created when I run my script (even if he doesn't have read access to my…
Wildcard
- 35,316
- 26
- 130
- 258
18
votes
2 answers
hook a script to apt-get
I have /tmp on a separate partition, and mounted with noexec. I am using Debian.
The installation of some packages fails, because the post-installation scripts of some packages need to run from /tmp.
I was wondering if it would be possible to "hook"…
user1968963
- 3,973
- 13
- 37
- 56