Tag Archives: Bash

A tiny script to replace all occurrences of a string in a file with another string

sed -i ‘s/original/new/g’ filename.txt This basically replaces every occurrence of the “original” string with the “new” string in the file named “filename.txt” e.g. sed -i ‘s/192.168.0.1/192.168.1.1/g’ /etc/fstab Will replace all occurrences of the IP “192.168.0.1” with the IP “192.168.1.1” in … Continue reading

Posted in Linux | Tagged , , , | 1 Comment

How to use the ip command to bring up/down the network interface on Linux

The ip command is replacing ifconfig, which is getting deprecated and some distros have already removed it. To bring a network interface down, simply run the following: sudo ip link set enp0s25 down To bring it back up: sudo ip … Continue reading

Posted in Linux | Tagged , , , , | Leave a comment

Integrating SSH PKI with Active Directory using PBIS-Open on Ubuntu 16.04

Long Article Warning! You can skip all this and go directly to the script at the end. This resolves the dilemma of managing SSH public keys on servers that are integrated with Active Directory using PBIS-Open, it allows you to … Continue reading

Posted in Linux | Tagged , , , , , , , , | Leave a comment

How to clear your bash history

For old commands, just edit .bash_history and delete whatever you want from inside. For commands in the current session, just run this command before you exit: unset HISTFILE The $HISTFILE environment variable is the one which holds your commands and … Continue reading

Posted in Linux, Uncategorized | Tagged , , , | Leave a comment

How to delete all files in a folder EXCEPT certain ones in BASH

Imagine you have a folder that has about 20 files that you need and like 100 files that you don’t. In this case, there is a very simple bash script that allows you to do that in a jiffy! Here … Continue reading

Posted in Linux, Uncategorized | Tagged , , , | Leave a comment

How to change the Linux prompt

Sometimes the Linux prompt doesn’t look really attractive and/or practical, like for example bash:/ or sh:/ which is really annoying. To solve this, you need to use the PS1 environment variable and append to it what you need: Go to … Continue reading

Posted in Linux | Tagged , , | Leave a comment

Getting VMWare Workstation 12 Pro to work on Ubuntu Wily (15.10)

Just add this line to the  “/usr/bin/vmware” file: export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libglibmm-2.4.so.1/:$LD_LIBRARY_PATH immediately after the “export PRODUCT_NAME bla bla bla” line. That’s it! Enjoy! Source: http://askubuntu.com/questions/689123/vmware-wont-work-after-ubuntu-upgrade

Posted in Ubuntu | Tagged , , , , , , | Leave a comment