How can you delete specific files in /temp in site server? [closed] - linux

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 1 year ago.
Improve this question
My site is experiencing Internal server Errors, website shutdowns and the main cause is a full /temp directory. The support gave us a list of large temp files that come with a size exceeding 1 GB. Is there any way to delete specific files in /temp?
ls -lah /tmp
I've used this code to go to my /temp file. How can I delete specific files in it?

Change directory to tmp - cd /tmp
And delete specific files - rm -f specific.file.name

You can use find for that:
find /temp -size +1G -delete
This means the following:
/temp : location of the search (subfolders are searched too)
-size +1G : the size should be larger than 1Gb
-delete : once such a file is found, delete it.

Related

how to search a file only in user profile and root in linux/unix [closed]

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 3 years ago.
Improve this question
Currently i am using the below find command to find the cert8.db file
find / -type f -path '.mozilla/*' -name "cert8.db"
The above command is trying to search the file everywhere.
I would like to scan the file only under root and user profiles(Unknown, unknown1 etc).
most common location for this file is:
in root: /root/.mozilla/firefox/i636e2gs.default/cert8.db
profile unknown:
/home/unknown/.mozilla/firefox/bz5xry7t.default-beta/cert9.db
profile unknown1:
/home/unknown1/.mozilla/firefox/bz5xry7t.default-beta/cert9.db
Note: I am not sure, this could be the Mozilla's default initialization location.
Thanks,
find expects zero, one, or more paths where to look for files and apply its expressions. Replace (/ = file system root) with all locations you want to be searched:
find /root /home -type f -path '.mozilla/*' -name 'cert8.db'
You might even limit the search space further by moving the .mozilla part into the list of starting points if it is a reasonable assumption that the .mozilla directory is always a direct child of the root folder or the home directories (making your shell do the work instead of find):
find /root/.mozilla/firefox /home/*/.mozilla/firefox -type f -name 'cert8.db'

Linux where does zip place the newly created zip file? [closed]

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 5 years ago.
Improve this question
Looking to zip up a folder on my linux box ie zip -r9 test /var/www/html/ where does that resulting test.zip file end up? in my pwd? I still want to leave the contents of /var/www/html intact.
Yes, it creates zip in your current working directory.
True is that you are free to specify relative or absolute paths like you wish.
zip test.zip path/to/files
will place test.zip in the current working directory.
zip /foo/bar/test.zip path/to/files
will place test.zip in /foo/bar

how to deal with file without a name in linux? [closed]

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 6 years ago.
Improve this question
I'm a green hand to linux using the vmware called Parallels on my mac and the edition I use is CentOS7.When I use the ls -al command, I found some files don't have name as follow in surprise:
I just want to know as these files are seemingly generated at a same time, what are they? how to delete them?
On *nix system every file has an atrribute called i-node. You can find with command
ls -i
when you have i=node number you can delete file by
find . -inum 782263 -exec rm -i {} \;
You could use any other commands not only rm.
more details you can find here
http://www.cyberciti.biz/tips/delete-remove-files-with-inode-number.html
As the d in drwxr-xr-x states, those are folders (or at least the filesystem thinks they are). You may use Midnight Commander to delete them. You may already have it installed on your machine, try to run mc to see if it's there.

How to find current folder size in linux [closed]

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
When I type df -h it shows a folder of size 200GB, but when I try to find the size of any of the sub-directories by du -sch /path the folder size is 10kB. I know that certain sub-folder should be of size 100GB.
How do I find the size of the current folder/directory in Linux?
Use: du -sh * , this will give you the size of all the directories, files etc in the pwd in a readable format (you can get rid of the * if you wish obviously to get the size of just the pwd).
Read man du , also this has some very nice examples.
When you run du -sch /abc it doesn't show the size of hidden files (the files/directories that have the prefix dot(.) in their names) in the abc .
To check the size of all the files you can run, assuming you are in the directory abc
for i in `ls -a`; do du -sh $i ; done | sort -h
This will also sort the list.

Linux linking folders [closed]

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 two folders /tmp/logs and /home/tmp/
/tmp/logs has 50 files already in it.
I want to move all the files to /home/tmp and also when a new file is created in /tmp/logs it gets created to /home/tmp instead.
So /tmp/logs just exist as a folder but nothing gets created inside it.
#move /tmp/logs to their new location
mv /tmp/logs /home/tmp
#replace the original /tmp/logs with a link to /home/tmp
ln -s /home/tmp /tmp/logs
Now whenever a program requests the kernel that anything be done in /tmp/logs, the kernel will see it's a symbolic link and will instead act on the corresponding file in /home/tmp (what the link points to).

Resources