This script will delete 10 days old files and send folder list via mail. You can change the value“-mtime X”depending on your requirement. Also, replace your email id instead of us. # /opt/script/delete-old-files.sh #!/bin/bash ...
Here, we list some basic bash syntax with a brief explanation. It is a good starting point if you are a beginner.
Thefindcommand is probably one of the most used tools within the Linux operating system. It is extremely useful in interactive shells. It is also used in scripts. WithfindI can list files older or newer than a specific date, delete them based on that date, change permissions of files or d...
forx := 1 to 10dobegin statements endforname [in list]dostatements that can use$namedonefor((initialisation ; ending condition ; update))dostatements...done whileSyntax: whilecondition;dostatementsdone untilSyntax: untilcondition;dostatementsdone ...
This principle can be used with all of PacUI's options. Here is another random example (of PacUI's hidden "List Packages by Size" option): pacui LS pacui -LS pacui --LS pacui ls pacui -ls pacui --ls Start PacUI without UI: Using Options and Package Names ...
If this variable is in the environment when bash starts up, each shell option in the list will be enabled before reading any startup files. This variable is read-only. BASHPID Expands to the process id of the current bash process. This differs from $$ under certain circumstances, such as...
f1 -nt f2 file f1 is newer than f2. f1 -ot f2 file f1 is older than f2 Comparison Operators Comparison operators are used in bash to compare two strings to check if they are equal or not. Here, we will list some comparison operators including, string, and integer operators. Integer ...
Here is a function that allows you to list all files that were last modified on the date you give as argument. Once again, we choose a function for speed reasons. No pun is intended by the function’s name: function lsd { date=$1 ls -l | grep -i "^.\{42\}$date" | cut -c5...
builtin for more dynamic control of readline than the startup file permits. .B Bind is used in several ways. In .I list mode, it can display the current key bindings, list all the readline editing directives available for binding, list which keys invoke a given directive, or ...
Since every normal directory contains a.and.., you don’t need to see those.You can usels -Ato list all the files in a directory except those two. For other commands where you list files with a wildcard (i.e., pattern), youcan construct your wildcard in such a way that.and..don...