mrinalraj

Social and Technical Blogger

Learning Unix commands are very essential as it helps you to navigate easily in your directories and files. Today we will learn some basics Unix commands which is easy for any beginners to begin with. Also you will get to know some bonus tips in the end.

Let's begin with creating new file.

cat > filename : creates a new file, if files already exists then overwrites it.

cat >> filename: appends the content in the already existing filename, else if not found then creates a new one.

Now to see if file is created or not.

ls -li : long list the files present in that directory with the inode no.

Now if you want to list files which is in some other directory or same working directory then there comes the concept of Relative addressing and Absolute addressing.

Relative addressing and absolute addressing


Relative addressing: here we can move to the directory which is under that directory.

username@hostname directoryname$ cd directory_name

Absolute Addressing: here we specify address from the root username@hostname directoryname$ cd /home/username/directory_name

Lets play with calendar commands.

cal: prints the calendar of current month

cal mm yyyy : will print calendar of that year of that month.

cal year : will print the calendar of that year

In Unix, you can do calculations as well.

bc: It will open binary calculator. Here you can perform calculations.


ln filename linkname : it creates a new link pointing to the existing file “file_name”

where cp filename newfilename : creates a new file with “newfilename” and then copies the content of the filename into it.

Note ls -li will confirm that in the copy command there will be different inode number while link command creates a new link to file as they have the same inode no.

mkdir is used to make a directory and rmdir is to remove a directory

rm file_name: is used to remove a file_name

Till now we learned some basic tips. Time for some Bonus Tips.

passwd : this command is used to change the current password

sudo passwd -l username : to lock that username from the system

sudo passwd -u username: to unlock that username from the system

sudo passwd -e username: to expire the username password next time he logins he has to give new passwd

sudo passwd -d username: deletes the password of that account and sets that account passwordless.

In recent years, we have been in so much love for the free commodity without realizing we ourselves have become the commodity. We install only free apps from stores. This is to make you aware of the possible threat to our Right to Privacy which is very important:

What the problem is?

We have used Facebook like various free social networking sites which claims connecting people. Have you ever wondered how these proprietary companies are offering users its product for free? Yes, Facebook gets lots of revenue from adds. But how these adds are unknowingly so accurate? There has to be something tracking our data. These trackers know very effectively which sites have I visited and which product I looked in the cart. There has been many cases of phone tapping and call records that itself has put the citizens privacy a question.

Whom will our data benefit?

You might have gone through various surveys that asks you varieties of question and it will predict your personality. You fill it and submit ignoring the Terms and Condition. These can give them permissions to our personal data likes messages our locations etc. Now these contents are connected to my profile. Giving the direct access to any buyer about my pulse. These companies can now target the user by bombarding with the polarised content which is designed for me and seen only by me.

Why us?

We spent most of our time on these social sites liking and disliking the contents, called as data points . These data points can describe our personality. Through these personality they target those user whose decision can be influenced. These data are so much important to the buyer's that they can pay any amount. Most of the buyers are the political parities who want to influence the election by targeting its citizens. This is cheating democratic process of election. There is a instance during the Trump's Election campaign where a candidate named Ted Cruz won the election on the basis of the user's Facebook like. See how big that difference can cause. Data mining companies like Cambridge analytica had major role in his winning. According to the report Cambridge Analytica has stated that it has around 5000 data points of around millions of American's citizens.

Our privacy is our responsibility

We have to skeptic about our data sharing. You don't know how can some companies mines your data and influence you in their reasoning. Our society has to be updated with the current threat and unethical business model. As the world is getting more advanced keeping our data secure and private is very challenging. There have been many cases of data phishing and fraud calls where we unknowing share our personal and crucial details. The reason behind this is lack of awareness among the people. It is our duty to find the solution so that the technologies we build for human life enhancement should not break it.

gitCoffee

Got a dream contributing to FOSS projects but lacking confidence in git commands. Don't worry this blog is for you: Let's begin learning git with the following FAQ:

  1. What is git init and why it's used?

    git init: Using this command we first initialize a local git repository. The files we will add here will now be tracked by the git. Running git init command is safe it reinitialize if there is an existing one.

  2. What is git clone and how can I clone a project?

    git clone https://github.com/your_username/repo_name: Will clone the remote repository into a newly-created directory.

  3. What's the status in git?

    git status: This command gives the list of files that have not been committed. This includes modified files and newly created files.

  4. What is Staging? How can I add a file to staging?

    Staging is like a checkpoint where only those files are there which is to be committed. Here we do modify any changes before final commit. git add [file-name.txt]: This command adds the file-name.txt to the staging area.

  5. How can I add all files to the staging area?

    git add -A or git add .: Using this command we can add all new and changed files to the staging area.* Note: There are times when unwanted files like file_name.swp also get added and committed to avoid this it's better to add files one by one.*

  6. How to commit a change with a proper message?

    git commit -m "[commit message]" -m is used to allow adding a commit message
    Using this command we can move all the staging area files to commit area in the local repository.

  7. How can I delete a file or folder?

    git rm file-name or git rm -r folder-name The above command are useful when you are deleting a file or deleting multiple files. git rm -r file-name removes the duplicate file-name recursively.

  8. I have created multiple branches. How can I get all my branches?

    git branch: This command lists all the branches created in your local repository. The asterisk denotes the current branch. git branch -a: This will list all the branches in the local as well as a remote repository.

  9. How to create and delete a branch?

    git branch [branch name]: This command will create a new branch.Note this does not checkout the new branch. git branch -d [branch name]: This command will delete the branch. This is the safest way to delete a branch as it prevents deletion if there are any unmerged changes. git branch -D [branch name]: This command will forcefully delete the branch and also deletes the commits associated with the branch. *Note all the above will bring changes in the local repository.

  10. How can I delete a branch in a remote repository?

    git push origin --delete [branch name]: This command will delete a remote branch.

  11. Can I create a new branch and automatically switch to it?

    Yes, you can use git checkout -b [branch name] command to create a branch and switch to that branch automatically.

  12. How to change branch present in a remote repository?

    Well, It depends on the Git version you are using. For modern version of git: git checkout [remotebranch] For older version of git : git checkout [remotebranch] origin/[remotebranch]

  13. What are the ways to see my commits?

    • git log: Using this we will see all the changes committed in the repositories.

    • git log --summary: Using this we get the detailed view of the changes made in the repositories.

    • git log --oneline: This command gives the history of the commits in brief.

  14. What are the ways to discard changes made to the file?

    • git checkout -- [file-name.txt]: This command will permanently discard all the changes made in the branch local repository.

    • git stash: This command will remove the changes made in the current branch but saves it for later use. So using git stash pop we can get back the saved changes made in the file of that branch.

First of all kudos for successfully creating `.onion' address. If not, see my previous blog. Tor Browser

Just having a domain is useless if you don't know how to make use of it. So let's begin with the newly created domain. Note the following guidelines are verified on Ubuntu 18.04

Step 1 : First make a directory :-

sudo mkdir /var/www/your_directory_name cd /var/www/your_directory_name/

Step 2 : Create a file name index.html :-

touch index.html

Step 3 : Editing the newly created file

sudo vi index.html : sudo gives the power to override the readonly files Press 'i' to go in INSERT mode Write your good name Press ESC and give :wq as command to save index.html and exit vi Editor.

Step 4 : Editing the root :

cd /etc/nginx/sites-available/ : If says permission denied sudo it :) sudo vi default : It will open long content. Edit the root line from '/var/www/html' to '/var/www/yourdirectoryname'. Save and exit.

Step 5 : Reloading nginx :

systemctl reload nginx

Kudos our work is done

Step 6 : Open your domain name in Tor Browser :

Incase you forgot your domain name. Type sudo cat /var/lib/tor/hidden_service/hostname

Happy Coding :)


Onion Note : The following guidelines are verified on Ubuntu 18.04 First install tor and nginx using the following commands: sudo apt install tor sudo apt install nginx sudo ufw allow Nginx Full

Open Terminal and enter : vi /etc/tor/torrc command press i to go in INSERT mode. then search for ############### This section is just for location-hidden services ###

Un-comment the following 2 lines by removing “#” symbol. HiddenServiceDir /var/lib/tor/hidden_service/ HiddenServicePort 80 127.0.0.1:80

to exit vi press Esc then enter :wq to save the changes and exit.

Try to restart the tor and nginx services by the following two commands: sudo service tor restart sudo systemctl restart nginx

On entering the command : sudo ls /var/lib/tor/hidden_service/ you will find filename such as hostname and private key. Enter : sudo cat /var/lib/tor/hidden_service/hostname use will find .onion address. Check it on the Tor browser.

“Congrats you got your own new domain.”

This post may contain error. Please bring it to the notice to help others. By connecting Mrinal Raj


First things first, we should be thankful that we all live in a country where there is freedom to speak on our views. As decades passed and technology evolved the ways of expressing our views have changed completely. We spend most of the time on various social networking sites, updating status almost regularly, sharing our locations, our likes and dislike, our religion and even our views on politics. Now the question is what if we are being tracked? What if these data are easily available to the trackers. You are then left with two replies :

  • Either you completely deny the fact that it is possible.
  • Or you say you got nothing to hide and got no problem with it!

You will find most of the people who state that they have nothing secret in them to hide, it sounds like you don't care about your fundamental rights as you have got nothing special to speak.

To say that you have nothing to hide means like you have nothing to say to protect your freedom of speech.

-Edward Snowden

If you think your privacy is safe and no one is peeping inside your personal and professional life, you need to go through inspiring true story of Edward Snowden and how he was chased when he chose the path of adversaries to benefit others instead of spending rest of his life luxuriously.

Edward Snowden


Edward Joseph Snowden was working as a contractor under US Government where he had access to all the classified files collected from the global surveillance. Edward revealed in public misuse of around billions of internet data and telephonic data records which is called metadata collected by government globally without user's interest. Edward saw that this was a direct attack on the citizens' Freedom of Speech and privacy.

Government's Point of View


Right after the 9/11 attack on the World Trade Centre, US government took various steps to curb terrorism among which one was to give secret access to US State Secret Service which can conduct the surveillance on any of citizen's phone record, GPS location, browser history, etc. Through MNC's like Google, Facebook, Apple they started to gain the data on the citizens. According to the report, there have been about 1.2 million people under the US watch list. Government believes that they can prevent terror attack before it happens using mass surveillance at the stake of our Right to privacy.

Conclusion


Most of the time we fall prey to the online trackers like Facebook and Google where our privacy is more vulnerable. We should try to avoiding websites that tracks our identity and location. Always open-source software should be preferred over a proprietary one.


Hello Python fans, if you are looking for building any python projects and at the same time making it interactive. You have to make use of several GUI packages in python. Python supports tkinter and other GUI frameworks like kivi, WxPython you can make several user friendly and interactive interface.

So using fewer lines of code in python you can create a Notepad like interface.


Mrinal's blog

Hello visitor , This is my first blogpost from #dgplug. I write articles and blog related to Tech, algorithms and programming language. Previously I had written from the Wordpress, some of them are :

* The Legacy of Aaron Swartz * Negative Experience and Positive Impact * The Python

Visit and Don't forget to give suggestions there :)