Bonus Topic – How to enable Bash on Ubuntu on Windows application in a windows 10 device and check which version is it running.

Hi Readers,

I am happy to post another blog post on how to enable bash on ubuntu on windows application in a windows 10 device and check which version is it running.

If you have done this step (link) then proceed the below steps.

Open Settings –> Update & Security –> For Developers

Enable Developer Mode and restart the system.

bash-on-windows-10-josepraveen

After restarting your system just search for bash on ubuntu for windows 10. A command prompt opens.

To check which Ubuntu release has been installed. Type

cat /etc/lsb-release

josept@LENOVO-PC:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.4 LTS"

My system is running Ubuntu 14.04.4 LTS.

Happy Learning !!

Schedule a task in linux using crontab

Hi Readers,

I am happy to post another blog post on how to schedule a task in linux using crontab.

cron enables users to schedule jobs to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration. cron checks for scheduled jobs every minute but not every second.

 

* * * * * command or shell script to be executed
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (0 - 6) (0 is Sunday, or use names)
│ │ │ └────────── month (1 - 12)
│ │ └─────────────── day of month (1 - 31)
│ └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)

Use the below command to check existing cron that has been scheduled in the linux box.

$ crontab -l

Use the below command to edit the cron entries.

$ crontab -e

 

Schedule a job to run everyday at 12.10  am.

10 0 * * * /usr/jpraveen/testautomate.sh

Schedule a job to run every sunday at 12.10  am.

10 0 * * 7  /usr/jpraveen/testautomate.sh

Schedule a job to run only on weekends at 12.10  am.

10 0 * * 6,7  /usr/jpraveen/testautomate.sh

Schedule a job to run everyday  at 9  am and 6 pm.

0 9,18 * * *  /usr/jpraveen/testautomate.sh

 

Thanks for reading this post. Subscribe my blog for  some awesome posts.

Happy Learning !!

JSON format in GNU/linux- Bash for Windows 10

Hi Readers,

I am happy to post another blog post on how to format a JSON string in GNU/Linux.

If a string is large then JSON looks very cryptic and it becomes difficult to search/edit it.

We can format easily using the Python interpreter. Python provides JSON modules that will do the needful.

#echo ‘content’ | python -m json.tool

josepraveenjsoninbash

Hope this post helps you. Please subscribe and comment if you have any doubts.

Happy Learning !!

Uninstall packages in bash for Windows 10

Hi Readers,

I am happy to post another blog post on how uninstall packages in bash for Windows 10.

I just updated my system to Windows 10 Anniversary update. Hurray!! I found bash (beta) feature in my Windows 10.

So, this post is about uninstall packages in bash.

How to get list of packages installed in your system?

just type dpkg --list

josepraveenwindowsbash

You will see the list of packages installed.

Do you like to uninstall a particular package?

just type sudo apt-get --purge remove nmap

josepraveenwindowsbashpurge

Now, the nmap package gets deleted.

Just read this post How to get bash on Windows 10?

Hope, this helps you to delete the unwanted packages in Windows 10 Bash.

Find the total number of directories and files present- Bash for Windows 10

Hi Readers,

I am happy to post another blog post on how to find the total number of directories and files present.

#sudo apt-get install tree

#tree name-of-the-directory/ | tail -1

josepraveentree

Hope this post helps. Please subscribe for future updates.

Find large files in a directory- Bash for Windows 10

This post is about how to find large files in a directory.

#ls -lSrh  where r causes the large files to be listed at the end.

Hope this post helps. Please subscribe and comment.

Encoding and Decoding base64 in bash for Windows 10

Encoding and Decoding base64 in bash

josepraveenencodedecode

Hope this tip will help you. Please subscribe and comment if you have doubts.