Useful ubuntu commands

Useful commands for the users running RS & GIS software in Ubuntu OS

  1. cd / =======> Takes you to the root directory.

  2. cd .. =======> Takes you to the previous directory

  3. pwd =======> Print working directory

  4. ctrl + shift + c =======> Copy the highlighted command to the clipboard

  5. ctrl + shift + v =======> Paste the highlighted command to the clipboard

  6. ctrl + c =======> Kill the current process

  7. ls =======> Print the list of files

  8. ls -lrt =======> Print the list of files with their details (size, write permission, time stamp etc.)

  9. ping ipaddress =======> To check whether the PC is working or not

  10. clear =======> Clear the console

  11. df =======> Displays information about the disk space usage

  12. mkdir =======> Create a new directory in your current working directory

  13. rmdir (“remove directory”) =======> Removes an empty directory

  14. rm -r (“remove recursively”) =======> Removes a directory along with its content

  15. cp somefile /home/some_location_path =======> Copy a file to a required location

  16. mv somefile /home/some_location_path =======> Move a file to a required location

  17. scp -r /home/Data/ pi@178.22.65.65://application/pi/VVSK/ =======> Copy data from one PC to another PC

VIM editor

  1. i =======> Insert mode

  2. esc =======> Command mode

  3. gg =======> To move you to the start of the file

  4. k =======> Moves the cursor up one line

  5. j =======> Moves the cursor down one line

  6. nG or :n =======> Cursor goes to the specified (n) line {Example: 10G cursor goes to 10th line}

  7. dd =======> Delete line

  8. yy =======> Yank current line

  9. p =======> Paste below cursor

  10. :q! =======> Quit (no warning)

  11. :wq =======> Write file to disk and quit the editor

VPN installation procedure

The Virtual Private Network (VPN) installation procedure in Debian OS is as follows. Open command prompt in Debian and execute the following commands

  • sudo apt-get install openvpn

  • sudo apt install network-manager-openvpn network-manager-openvpn-gnome

  • sudo openvpn --config IITBADV.ovpn

  • Enter the user name and password

Extraction of URL's on a web page

  • Open the web page in Google Chrome and press Ctrl+Shift+I to open the developer mode.

  • Go to console tab and type the following code that suites the user requirement. Once the URL's extracted, copy the links and paste them in notepad. By using find and replace options remove the unnecessary text from the URL's.

Extract URLs & Corresponding Anchor Text

var urls=$$('a');

for(url in urls){

console.log("#"+url+" > "+urls[url].innerHTML +" >> "+urls[url].href)

}


Extract Links with their anchor text (For Chrome & Firefox)- Styled version

var urls=$$('a');

for(url in urls){

console.log("%c#"+url+" > %c"+urls[url].innerHTML +" >> %c"+urls[url].href,"color:red;","color:green;","color:blue;");

}


Extract URLs Only

var urls=$$('a');

for(url in urls)

console.log(urls[url].href);


Extract External URLs Only

var links = $$('a');

for (var i = links.length - 1; i > 0; i--) {

if (links[i].host !== location.host) {

console.log(links[i].href);

}

}


Extract URLs with a specific extension

function getLinksWithExtension(extension) {

var links = document.querySelectorAll('a[href$="' + extension + '"]'),

i;


for (i=0; i<links.length; i++){

console.log(links[i]);

}

}

getLinksWithExtension('mp3') //change mp3 to any extension