Useful ubuntu commands
Useful commands for the users running RS & GIS software in Ubuntu OS
cd / =======> Takes you to the root directory.
cd .. =======> Takes you to the previous directory
pwd =======> Print working directory
ctrl + shift + c =======> Copy the highlighted command to the clipboard
ctrl + shift + v =======> Paste the highlighted command to the clipboard
ctrl + c =======> Kill the current process
ls =======> Print the list of files
ls -lrt =======> Print the list of files with their details (size, write permission, time stamp etc.)
ping ipaddress =======> To check whether the PC is working or not
clear =======> Clear the console
df =======> Displays information about the disk space usage
mkdir =======> Create a new directory in your current working directory
rmdir (“remove directory”) =======> Removes an empty directory
rm -r (“remove recursively”) =======> Removes a directory along with its content
cp somefile /home/some_location_path =======> Copy a file to a required location
mv somefile /home/some_location_path =======> Move a file to a required location
scp -r /home/Data/ pi@178.22.65.65://application/pi/VVSK/ =======> Copy data from one PC to another PC
VIM editor
i =======> Insert mode
esc =======> Command mode
gg =======> To move you to the start of the file
k =======> Moves the cursor up one line
j =======> Moves the cursor down one line
nG or :n =======> Cursor goes to the specified (n) line {Example: 10G cursor goes to 10th line}
dd =======> Delete line
yy =======> Yank current line
p =======> Paste below cursor
:q! =======> Quit (no warning)
: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