Category: OS
-
Unix – Delete files older than a certain number of days using find command
Delete files older than 30 days find . -mtime +30 -exec rm {} \; 1. Save the deleted files to a log file find /home/a -mtime +5 -exec ls -l {} \; > mylogfile.log This way, you’ll get a line at top with the date the line is executed (also a line at the bottom).…
-
Linux – cd – – move to previous directory in bash shell
Going back to the last directory you were in as easy as: cd – cd MINUS References 1. http://superuser.com/questions/113219/go-back-to-previous-directory-in-shell
-
Monit – Monitoring and Automatic Server Restart in Linux
Installation Monit is a great application for monitoring and starting and automatically re-starting applications sudo apt-get install -y monit The version installed this way is an old version, NOT the latest stable one Example configuration for Cassandra sudo tee /etc/monit/monitrc
-
Unix – Set Multi-Line Text To A String Variable Or Text File in Bash
There are many ways to save a multi line string in bash. This is post just shows how to output a multiline string. The Basics – Quoting Variables From the bash(1) man page: If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the…
-
DBeaver – Apache Cassandra GUI – Universal Database Manager Installation in Ubuntu
DBeaver – Universal Database Manager – Installation # download and dbeaver mkdir -p ~/build/dbeaver cd ~/build/dbeaver # download wget http://dbeaver.jkiss.org/files/dbeaver_2.1.1_amd64.deb sudo dpkg -i dbeaver_2.1.1_amd64.deb # link beaver executable sudo ln -s /usr/share/dbeaver/dbeaver /usr/local/bin/dbeaver # download jdbc drivers – which also include support Cassandra # also wget http://dbeaver.jkiss.org/files/driver-pack-2.1.1.zip unzip driver-pack-2.1.1.zip -d driver-pack sudo cp -r driver-pack/*…
-
Jetty – Installation on Linux
# create download directories mkdir -p ~/build/jetty cd ~/build/jetty # download version=”9.0.0.v20130308″ wget -O jetty-distribution-$version.tar.gz “http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-$version.tar.gz&r=1” # extract the archive – creates directory jetty-distribution-…. tar -xvf jetty-distribution-$version.tar.gz # rename jetty directory sudo mv jetty-distribution-$version /usr/local # create jetty user sudo useradd -U -s /bin/false jetty # Copy Jetty script to run as service sudo chown…
-
Unix – Find Files By Age And Timestamp
Find files by date and regex find the files modified more than 3 days ago … good candidates for a clean up sudo find . -iregex “.*\(bootcd\|src\).*.zip” -type f -mtime +30 -exec ls -l “{}” \; Finding the newest files # find text files changed today containing the text “gugu” find . -mtime 0 -type…
-
Unix – zip – Compress a directory including all its files and sudirectories
Compress files and directories using ZIP zip -r mydir.zip mydir zip -r mydir.zip /home/myuser/mydir the “-r” option means recursive and adds all files in the named directory Zip only certain files, recursively zip -R AllMyDocs.zip “*.doc” The command above saved all .doc files in the current directory as well as the subdirectories into AllMyDocs.zip. The…
-
Ubuntu – Add and Delete a PPA
Add a PPA Example: ppa:e2defrag/ppa sudo add-apt-repository -y ppa:e2defrag/ppa sudo add-apt update Remove a PPA Example: ppa:e2defrag/ppa sudo add-apt-repository -y ppa:e2defrag/ppa –remove sudo add-apt update