Posts marked with "Terminal" in tags

How To Install & Run Composer Binaries Globally

Take PHPUnit as an example. You can install it using Composer doing this : composer require phpunit/phpunit This will install a phpunit shortcut in vendor/bin directory. This obviously means you can run it. But, you would have to point to the exact location of the phpunit file to run : /home/username/mysite/vendor/bin/phpunit phpunit.xml But, that’s long and uncomfortable. And you would have to install PHPUnit separately for each projects. I’m gonna tell you how to install binaries globally as well as running it simply.... [READ MORE]

Variables in Bash ": command not found"

Bash is like the very complicated language, even a space can make a syntax error. But, when you get into it often, you will get a hang of it and it will be easy. This post is a solution to one of the most common problems that happen to a newbie in Bash and it’s about a single whitespace. Here is a sample Bash file : a = 50 echo $a and when you execute it, the error will be as follows :... [READ MORE]

Executing Terminal Commands in Python & PHP

Python & PHP are great languages and there are many similarities between them. In this short post, you will learn how to execute terminal commands in PHP & Python. PHP As I said before many times in other posts, there areexec andsystem command to execute commands : exec("firefox ‘http://subinsb.com’"); Or in the other way : system("firefox ‘http://subinsb.com’"); Python In Python, there is no exec or system function. But there is a system function in the os nodule.... [READ MORE]

Configuring SSH to Enter a Password Automatically

As you know, when you SSH into a system, it will ask for the password which you have to enter everytime. But in cases where you’re SSHing in a script or in a loop, its a really time consuming and boring thing to enter password everytime. So, in this case you have to configure SSH to use a password to enter when asked. But, there is no default option in the ssh command to set this due to security reasons I think.... [READ MORE]

Identify Remote OS By IP Address In PHP

In the recent post, I gave the default TTL value of different devices. As you can see, when you ping a host you can roughly identify the operating system the remote server’s running. I saw a question on Stack Overflow about this. Sadly it was down voted and was removed later. I tested if it is possible and I found that it is possible. In this post, I will give a function that automatically pings the remote host and find out the possible Operating Systems the remote server is running.... [READ MORE]

How To Use Hard Disk As RAM In Ubuntu Linux

I heard that it is possible to use a portion of hard disk as RAM in Windows. I wondered if this trick is available for Ubuntu, so I googled about it and couldn’t find anything related to it. But I found out an AskUbuntu answer of using USB sticks as RAM. I did the same trick on Hard Disk and it works !! This trick can be accomplished with the use of some small commands in Terminal.... [READ MORE]

Loading A Window Created Using GLADE in Python

If you have created a window using Glade and want to display this window on your Python program containing the event handlers of the Window, then you should follow this tutorial. This small code will load the Glade file and displays the window. Note : The Glade Project file format should be GtkBuilder. Now, let’s get down to the code. Create a Python file named window.py in the folder containing the glade file and put in the following contents :... [READ MORE]

Setting up Google DNS in Ubuntu

Google‘s DNS service is spreading rapidly. It’s time for you to use it. I used it and noticed some great speed changes even though my internet is just a dial up connection. Here is how to set up Google‘s DNS on your Ubuntu Linux. Open Network Settings (network-admin) by going to System -> Preferences -> Network Connections. Go to your default net connection and click on Edit button. You will get a window like below : Change the Method option to Automatic (PPP) addresses only.... [READ MORE]

Execute Command Without Waiting For It To Finish

If you just execute a terminal command using exec or system in PHP, the page will only load completely until the command has been finished. If you are running commands to run a websocket server, the page will not load, because the start server command won’t terminate. So to avoid this problem you should just do a simple trick, Just add > /dev/null & after the command you’re running.... [READ MORE]

Program to Replace localhost links with website url

If you are working on a project and wants to upload the project to your site, then you have to manually replace all the localhost links with the site url. I created a small Python program that will replace localhost links with your WWW site url. Here is the Python code : #!/usr/bin/python import os indir = ‘/var/www/mysite‘ #!Folder of your localhost site. for root, dirs, filenames in os.walk(indir):  for f in filenames:... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab