Linux

How to get information about a file such as last access, modified or changed time using Linux

H

NOTE: Tested and tried on Ubuntu 9.04   Answer: By using the ‘stat‘ command. stat = Display file or file system status Example: Input: stat photos-20090916-0.db Output: File: `photos-20090916-0.db' Size: 3072          Blocks: 8          IO Block: 4096   regular file Device: 807h/2055d    Inode: 529743      Links: 1 Access: (0644/-rw-r--r--)  Uid: ( 1000/  user)   Gid: ( 1000/ ...

How to find the IP address of your Machine using Linux

H

There are a number of ways to find the IP address. Examples below ifconfig – Deprecated, rather use the ‘”ip'” command Input: {codecitation style=”brush: shell;”}ifconfig{/codecitation} Output: {codecitation style=”brush: shell;”} eth0      Link encap:Ethernet  HWaddr 00:0c:6e:c5:67:89 UP BROADCAST MULTICAST  MTU:1500  Metric:1 RX packets:0 errors:0...

How to fix PHP Fatal error: Class ‘DOMDocument’ not found in /var/www/html/index.php on line 171 or similar error

H

NOTE: Received this error on a Centos 5 environment while trying to run a PHP script that makes use of the DOMDocument class
 
In the CLI (Command Line Interface) run the following command
{codecitation class=”brush: shell;”}
yum install php-xml
{/codecitation}
This will install XML support and will solve the DOMDocument issue

How to rename files and folders using the command line in Linux

H

We accomplish this by using the “mv” (move command) Example: File Example: {codecitation class=”brush: bash;”}mv old_file new_file{/codecitation} Directory Example: {codecitation class=”brush: bash;”}mv old_directory new_directory{/codecitation} NOTE: mv can move several files into a destination folder, or a single file. mv renaming will contain the original...

How to uninstall GNOME-DO in Ubuntu

H

Open a new Terminal Window
Type in the following command and press enter
sudo apt-get autoremove gnome-do

This will remove gnome-do and all dependencies

Definition: autoremove is used to remove packages that were automatically
installed to satisfy dependencies for some package and that are no
more needed.

How to convert RPM packages to DEB packages using Ubuntu

H

NOTE: Has been tested on Ubuntu 9.10 In Ubuntu open Synaptic Package Manager ‘System->Administration->Synaptic Package Manager‘ Now we need to install 2 apps called alien and fakeroot alien – Convert and install rpm and other packages fakeroot – Gives a fake root environment To install them simply type alien in the Quick search box and mark for installation and do...

How to find out how much space a directory takes up using Linux

H

In the command line type the following command within the desired directory {codecitation class=”brush: bash;”}du -c{/codecitation} This will give you the usage/size of all the folders within that particular directory.  du =  estimate file space usage -c = total To get the size/usage in a Human readable format eg. Megabytes/Gigabites append the -h option to the command above. Example...

How to enable SSH on Ubuntu

H

This could come in handy if your Desktop machine is at a Remote Location and you need to gain access to it. NOTE: SSH = Secure Shell Open a new Terminal Window (CLI) and type in the following command to install SSH {codecitation class=”brush: bash;”}sudo apt-get install ssh{/codecitation} After installation you can test it to SSH to your localhost (use your standard username and...

Installing Adobe Air on Ubuntu

I

NOTE: Tested on Ubuntu 9.10 Open a new Terminal Window  Download the following file  using the wget command{codecitation class=”brush: bash;”}wget {/codecitation} Save the file in your Home Directory or any other Directory Give the file executable privelages by using the following command {codecitation class=”brush: bash;”}chmod +x AdobeAIRInstaller.bin{/codecitation} Now...

Google Chrome stays in full screen mode or behaves unusual on Ubuntu

G

NOTE: Experienced this problem with Google Chrome 5.0.342.9 beta on Ubuntu 9.10 Answer: First make a backup of all you personal settings eg. Bookmarks Close Google Chrome (Press the key combination Ctrl+e in order to close Chrome) Open a new Terminal Window and type in the following command rm -rf ~/.config/google-chrome or rm -rf /home/YOURNAME/.config/google-chrome Start Google Chrome and...

How to install Apache together with PHP5 on Ubuntu

H

How to install Apache together with PHP5 on Ubuntu? This becomes very handy if you wish to do some PHP development on Ubuntu.   Open a new terminal window (CLI) Execute the following commands: sudo apt-get install apache2 sudo apt-get install php5 sudo apt-get install libapache2-mod-php5 Now we need to restart Apache so that our changes can take effect. There are two commands for you to...

How to install MySql Server 5 on Ubuntu

H

NOTE: Tried and tested on Ubuntu 10.04

Open a new Command Line Window 
Execute the following command to install MySql Server 5

sudo apt-get install mysql-server

If you wish to use MySql together with PHP 5 you will need to install the PHPmodule for MySql 5. To do this open a Command Line Window and execute the following command

sudo apt-get install php5-mysql

How to search and replace text within a text file using the Command Line on Linux

H

This can be accomplished by using the sed command. sed =  stream editor for filtering and transforming text   For this example we will have a file called test.txt that contains the following text “This is a test file with some test information, containing some test data.“ We want to replace all instances of test in the file with cool and save the output to a new file called cool...

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me