Operating Systems
Dump binary file in different formats
Nov 26th
The “od” command can be used to dump a binary file at command line in Linux. Few examples are given below.
ASCII charcters: od -t c mydata.bin
Hex bytes: od -t x1 mydata.bin
Hex shorts: od -t x2 mydata.bin
Decimal shorts: od -t d2 mydata.bin
If you want a visual binary editor, you can try khexedit or xbindiff programs.
How to open PDF files in Fedora/RHEL/Ubuntu Linux
Nov 26th
Linux provides multiple options to open PDF files. If you are using GNOME as your desktop, ou can use “evince” application. If you are KDE fan, you can use “okular” application. Otherwise, you can try “xpdf” application as well.
If you are not sure about the name of Desktop you are using, just try all the commands at command-line and see if it works.
[neo@techpulp ~]# evince myfile.pdf
[neo@techpulp ~]# okular myfile.pdf
[neo@techpulp ~]# xpdf myfile.pdf
Typically you should have at least on of them installed in your system and should be able to open PDF files easily from the file manager.
You can use following More >
How to convert a number from decimal/octal to hexa-decimal format using bc command
Nov 25th
The “bc” command provides an arbitrary precision calculator language. The bc command can be used to evaluate mathematical expressions in the non-interface method as well as interactive method.
A typical interactive usage of bc command to evaluate a mathematical expression “100+200″ is as follows. The output from bc command is highlighted below.
[neo@techpulp ~]# bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 100+200 300 [neo@techpulp ~]#
A simple non-interactive way of using bash command to evaluate same expression is as follows.
[neo@techpulp ~]# echo "100+200" | bc 300 [neo@techpulp More >
How to view differences between two binary files in Fedora/RHEL Linux
Nov 21st
The tool VBinDiff can be used to check the differences between two binary files. This tool displays data in hexadecimal and ASCII formats. This is a very small tool and can be installed in any Fedora/RHEL system using yum utility as shown below.
[root@techpulp ~]# yum install -y vbindiff fedora | 2.8 kB 00:00 updates | 3.4 kB 00:00 Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package vbindiff.i386 0:3.0-0.2.beta4.fc10 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: vbindiff i386 3.0-0.2.beta4.fc10 updates 41 k Transaction Summary More >
How to disable colored display by ls command in Linux
Nov 13th
Sometimes it is annoying to look at the colored display of output by ls command. This is more evident if you use a dark color as background color of the terminal. In such cases, you can use alternative command ‘dir’ to see non-colored output. However it is difficult for one to change the commonly-used command easily. In such case, you can run the following command to make ls command to display non-colored output.
[neo@techpulp ~]# unalias ls
However the above command affect only your current shell. If you want to make this permanent, you can place the command towards the end of More >
How to solve “Could not detect stabilization, waiting 10 seconds” error in Fedora Linux
Oct 30th
As Fedora uses a simple and clean screen hiding all Linux kernel boot messages, a normal user wouldn’t notice the following error that delays boot by 10 seconds.
Could not detect stabilization, waiting 10 seconds
Once can see this error message on the screen if he or she presses Esc key. The Esc works both in text-mode boot and graphical-mode boot.
To get rid of problem of 10 seconds delay, just add the following option to kernel command line options in “/etc/grub.conf“.
rootdelay=1
For example, my grub.conf contains an entry similar to the following.
title Fedora 11 root (hd0,2) kernel /vmlinuz.fc11.i686 ro root=/dev/sda1 rhgb rootdelay=1 initrd /initrd.fc11.i686.img
From More >
How to print date and time in different time zone using command line in Linux
Oct 29th
The command “date” is used to display current date and time in Linux systems. The date command displays date and time in configured time zone in the system. The file /etc/localtime contains information about currently selected time zone. This file is copied from /usr/share/zoneinfo directory during system installation.
[neo@techpulp ~]# file /etc/localtime /etc/localtime: timezone data [neo@techpulp ~]#
If you want to change the current default time zone of the system, you should copy relevant file from /usr/share/zoneinfo directory to /etc/localtime file.
If you want to just display current date and time in a time zone other than default time zone, you need to set the More >
How to rename multiple files by pattern or wildcard in Linux
Oct 28th
Linux provides a command “rename” to help rename files using patterns. If you don’t see the rename command in your system, you can run the following command to install it under Fedora/RHEL Linux.
[root@techpulp ~]# yum install -y util-linux-ng
The following shows the syntax of rename command.
rename <from> <to> <files> from - source pattern to - destination pattern files - list of files to operate on
The following command renames all files with .htm extension to .html extension.
[neo@techpulp ~]# rename .htm .html *.htm
The following command renames all files with .jpeg extension to .jpg extension.
[neo@techpulp ~]# rename .jpeg .jpg *.jpeg
The following command searches recursively More >
How to reboot a Linux system remotely using ssh or telnet
Oct 12th
You can simply login to the remote system using SSH and execute “reboot” command to reboot it. But you must be logged in “root” user to be able to reboot the remote Linux system.
This example shows how to login using IP address.
[root@neo.techpulp.com ~]# ssh root@192.168.123.55
This example shows how to login using remote host name.
[root@neo.techpulp.com ~]# ssh root@www.techpulp.com
Typically after a successful login, you will get access to shell. You can run “reboot” command to reboot the remote system. This action will automatically terminate you current SSH session.
Otherwise, you use the following example to do the job with single command.
[root@neo.techpulp.com ~]# ssh More >
How to start or stop or restart a service in Fedora/RHEL/Ubuntu/Debian Linux
Oct 11th
The following examples show how to start or stop or restart a service in different flavours of Linux. In all these examples, the service name “httpd” is used. You can replace it with name of the service you want to start or stop or restart.
Starting a serviceIn RHEL or Fedora:
[root@techpulp ~]# service httpd start
or
[root@techpulp ~]# /etc/init.d/httpd start
In Debian Linux:
[root@techpulp ~]# /etc/init.d/httpd start
In Ubuntu Linux:
[root@techpulp ~]# sudo /etc/init.d/httpd startStopping a service
In RHEL or Fedora:
[root@techpulp ~]# service httpd stop
or
[root@techpulp ~]# /etc/init.d/httpd stop
In Debian Linux:
[root@techpulp ~]# /etc/init.d/httpd stop
In Ubuntu Linux:
[root@techpulp ~]# sudo /etc/init.d/httpd stopRestarting a service
In RHEL or Fedora:
[root@techpulp ~]# service httpd restart
or
[root@techpulp More >


Recent Comments