[LINUX] Create a command to delete all temporary files generated in a specific folder

In the ab initio molecular orbital software "Gamess" etc., mysterious temporary files such as "~ .dat" and "~ .F05" are generated in any folder and will not disappear even if the calculation in Gamess is completed. (Of course, it does not disappear even if the error ends.) So, I adopted the "alias" command as a command that can delete all of them at once.

Simply put, the alias command allows you to register your favorite commands and operations in the terminal using your favorite character string, and execute those commands from any directory.

Let's set it.

Suppose a temporary Gamess file is generated in the following location: Let's use "Qiita" as the user name

/home/Qiita/gamess/tmp

I want to unconditionally delete the files generated in this folder when I type a certain command. Here, if you type the character string "delete" in the terminal, set to delete all the files in the above folder.

alias


alias delete='rm -rf /home/Qiita/gamess/tmp/*'
#alias (1) = '(2)'

(1) ・ ・ ・ Character string to be registered (2) ・ ・ ・ Command to be executed when (1) is input In the above example, the rm command is associated with the character string delete, but of course you can use another command. I thought that this alias could be used for operations where commands are not continuous.

Also, the above alias command will be unregistered when you log out, so I think it's a good idea to register it in ~ / .bashrc.

Thank you for reading.

Recommended Posts

Create a command to delete all temporary files generated in a specific folder
2 ways to read all csv files in a folder
[Python] Rename all image files in a specific folder by shooting date and time
Batch convert all xlsx files in the folder to CSV files
Command to list all files in order of file name
How to combine all CSVs in a folder into one CSV
Generate all files with a specific extension
How to create a git clone folder
Read all csv files in the folder
Don't use rm command to delete files
Use shutil to delete all folders with a small number of files
[Python] Get the files in a folder with Python
Add a command to mark similar files together
I want to create a window in Python
How to create a JSON file in Python
Create a command to encode / decode Splunk base64
Zip-compress any file with the [shell] command to create a file and delete the original file.
Use click to create a sub-sub command --netsted sub-sub command -
Create a custom search command in Splunk (Streaming Command)
Try to create a new command on linux
How to create a shortcut command for LINUX
How to get the files in the [Python] folder
Don't forget to close the file just because it's in a temporary folder
How to create a Rest Api in Django
How to count numbers in a specific range
Create a command to get the work log
[Python] I want to collect specific files scattered in each folder in one place
I tried to create a class to search files with Python's Glob method in VBA
Create a plugin to run Python Doctest in Vim (2)
Create a plugin to run Python Doctest in Vim (1)
How to execute a command using subprocess in Python
How to reference static files in a Django project
Recursively get the Excel list in a specific folder with python and write it to Excel.
Create a list in Python with all followers on twitter
[Command] Command to get a list of files containing double-byte characters
I made a command to generate a table comment in Django
Process the files in the folder in order with a shell script
Delete all libraries installed on pip with a single command
Create a tool to check scraping rules (robots.txt) in Python
Let's create a function to hold down Button in Tkinter
Simultaneously input specific data to a specific sheet in many excels
[Python] Create a program to delete line breaks in the clipboard + Register as a shortcut with windows
Create a function in Python
[systemd] Command to delete service
How to display a specified column of files in Linux (awk)
[C language] [Linux] Try to create a simple Linux command * Just add! !!
[sh] How to store the command execution result in a variable
How to get all the possible values in a regular expression
How to get a string from a command line argument in python
[Go] Create a CLI command to change the extension of the image
How to create a heatmap with an arbitrary domain in Python
An easy way to re-execute a previously executed command in ipython
How to create a large amount of test data in MySQL? ??
I want to create a pipfile and reflect it in docker
Create a function to get the contents of the database in Go
How to delete multiple specified positions (indexes) in a Python list
Find all patterns to extract a specific number from the set
I made a command to display a colorful calendar in the terminal
Get a list of files in a folder with python without a path
Create a command line tool to convert dollars to yen using Python