Featured

TechBytes on Linux

This is a growing list of Linux commands which might come handy for the of Linux users. 1. Found out i had to set the date like this: ...

Monday, August 6, 2012

TechBytes on Linux


This is a growing list of Linux commands which might come handy for the of Linux users.

1. Found out i had to set the date like this:
# date -s 2007.04.08-22:46+0000

2. Mounting
sudo mount -t cifs // < pingable_host_or_ip > / < win_share_name > /build -o user=,domain=,uid=string,gid=string

3. To install linux packages from internet (ubuntu only)
apt-get install

4. To determine what ports the machine is currently listening on
netstat -an | grep -i listen | less

5. Find in files in Linux
find . | xargs grep 'string' -sl


Find file names with a pattern & delete them


find . -name "IMG_*(1).JPG" -delete
6. To become superuser/root
sudo -i

7. To find a running process using name

ps -aef | grep "searchstring"

8. Alt + F2 opens run window in RHEL

9. To access windows share from linux
smb:///d$

10. To know the last reboot date & time
$ last reboot | head -1

11. To install RPM packages in RHEL
rpm -ivh

12. To un-install RPM package in RHEL
rpm -e

13. To display Linux Kernel version
uname --all

14. To list out the Linux partitions
cat /proc/partitions

15. To list of all writable storage devices in Linux
fdisk -l

16. Installing software from sources in Linux
http://www.tuxfiles.org/linuxhelp/softinstall.html

17. The -T option in the df command displays the file system type.
df -T

18. Open current directory from within the terminal
xdg-open .


18. Find out details about the CPU such as speed, type, no of cores etc
cat /proc/cpuinfo

19. Find out details about memory installed
cat /proc/meminfo
vmstat


20. To list out installed rpms
rpm -qa

21. To Disable firewall on RHEL 7.2
systemctl stop firewalld
systemctl status firewalld


22. Find out the Linux OS/Operating system version
a] /etc/*-release file.
b] lsb_release command.
c] /proc/version file.

23. Try this to reload your current shell
source ~/.profile


24. The following Linux commands can be used to search files by name.find /path -name *.txt
find /path -type f -name test.txt
find /path -name failed*.* -type f
find /path -type f -not -name “*.html”
find / -name “file.txt” -size +4M
find /dev/ -type b -name “sda*”


25. Scp commandThe SCP (Secure Copy Protocol) command is a powerful utility for securely transferring files and directories between two locations over a network. It leverages SSH (Secure Shell) for authentication and encryption, ensuring that both the files and passwords are protected during the transfer.
scp [OPTION] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2OPTION: Various options to control the behavior of scp, such as specifying the SSH port, enabling compression, or copying directories recursively.
[user@]SRC_HOST:]file1: Path to the source file, including the user and host if the file is on a remote machine.
[user@]DEST_HOST:]file2: Path to the destination file, including the user and host if the file is on a remote machine.


26. Proxy configuration on Ubuntu Linux



apt-get, aptitude, etc. will not obey the environment variables when used normally with sudo. So separately configure them; create a file called 95proxies in /etc/apt/apt.conf.d/, and include the following:Acquire::http::proxy "http://myproxy.server.com:8080/"; Acquire::ftp::proxy "ftp://myproxy.server.com:8080/"; Acquire::https::proxy "https://myproxy.server.com:8080/";


27. Find in files
a. Find a string in a text file inside a gz file.
zgrep -i -H "pattern match" *.gz

b. Find a string in a folder path
grep -r "foo" /home/thisuser/bar/baz/*





28. Scanning scsi disks in RHEL

1.Finding the existing disk from fdisk.
[root@mylinz1 ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-' Disk /dev/sda: 21.5 GB, 21474836480 bytes

2.Find out how many SCSI controller configured. [root@mylinz1 ~]# ls /sys/class/scsi_host/host host0 host1 host2

In this case,you need to scan host0,host1 & host2.

3.Scan the SCSI disks using below command. [root@mylinz1 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan [root@mylinz1 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan [root@mylinz1 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan

4.Verify if the new disks are visible or not. [root@mylinz1 ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-' Disk /dev/sda: 21.5 GB, 21474836480 bytes Disk /dev/sdb: 1073 MB, 1073741824 bytes Disk /dev/sdc: 1073 MB, 1073741824 bytes

From Redhat Linux 5.4 onwards, redhat introduced “/usr/bin/rescan-scsi-bus.sh” script to scan all the SCSI bus and update the SCSI layer to reflect new devices.
Install it using yum -y install sg3_utils command.
But most of the time,script will not be able to scan new disks and you need go with echo command.
Useful link on how to configure iSCSI volumes
https://www.cyberciti.biz/tips/rhel-centos-fedora-linux-iscsi-howto.html 29. Repeat the command every n seconds
watch -n 5 ls -lh <filepath>
or
# Source - https://stackoverflow.com/a
# Posted by mikhail, modified by community. See post 'Timeline' for change history
# Retrieved 2026-01-27, License - CC BY-SA 3.0


while true; do ls -lh <filepath> ; sleep 5; done


30. Reload the history file


The following will append the contents of file.txt to the current in-memory history list:history -r file.txt


You can optionally run history -c before this to clear the in-memory history.




how to reload the default history file, which it turns out is just history -r without the file path.






Saturday, July 2, 2011

How to filter unread mails in gmail

Ever wondered where is the button in gmail to view only unread messages ?
There is none. I found a way to do it.
Just type "is:unread" in the search email textbox in gmail.
And there you are !! You will be able to view only the unread emails in your gmail account !

Friday, May 27, 2011

The car which was allergic to vanilla Icecream

*************************************************************

Read this, absurd but true. Courtesy: The Internet.

This is a real story that happened between a customer of General Motors and its Customer-Care Executive . Pls read on…..

A complaint was received by the Pontiac Division of General Motors:

‘This is the second time I have written to you, and I don’t blame you for not answering me, because I sounded crazy, but it is a fact that we have a tradition in our family of Ice-Cream for dessert after dinner each night, but the kind of ice cream varies so, every night, after we’ve eaten,
the whole family votes on which kind of ice cream we should have and I drive down to the store to get it.

It’s also a fact that I recently purchased a new Pontiac and since then my trips to the store have created a problem…..You see, every time I buy a vanilla ice-cream, when I start back from the store my car won’t start. If I get any other kind of ice cream, the car starts just fine.

I want you to know I’m serious about this question, no matter how silly it sounds “What is there about a Pontiac that makes it not start when I get vanilla ice cream, and easy to start whenever I get any other kind?”

The Pontiac President was understandably sceptical about the letter, but sent an Engineer to check it out anyway. The latter was surprised to be greeted by a successful, obviously well educated man in a fine neighbourhood.

He had arranged to meet the man just after dinner time, so the two hopped into the car and drove to the ice cream store. It was vanilla ice cream that night and, sure enough, after they came back to the car, it wouldn’t start.

The Engineer returned for three more nights. The first night, they got chocolate. The car started. The second night, he got strawberry. The car started. The third night he ordered vanilla. The car failed to start.
Now the engineer, being a logical man, refused to believe that this man’s car was allergic to vanilla ice cream. He arranged, therefore, to continue his visits for as long as it took to solve the problem.

And toward this end he began to take notes: He jotted down all sorts of data: time of day, type of gas uses, time to drive back and forth etc.
In a short time, he had a clue: the man took less time to buy vanilla than any other flavour. Why? The answer was in the layout of the store.
Vanilla, being the most popular flavour, was in a separate case at the front of the store for quick pickup. All the other flavours were kept in the back of the store at a different counter where it took considerably longer to check out the flavour.

Now, the question for the Engineer was why the car couldn’t start when it took less time. Eureka- Time was now the problem – not the vanilla ice cream!!!!

The engineer quickly came up with the answer: “vapour lock”. It was happening every night; but the extra time taken to get the other flavours allowed the engine to cool down sufficiently to start.
When the man got vanilla, the engine was still too hot for the vapour lock to dissipate.

Remember :
Even crazy looking problems are sometimes real and all problems seem to be simple only when we find the solution , with cool thinking. Don’t just say it is “IMPOSSIBLE” without putting a sincere effort….Observe the word “IMPOSSIBLE” carefully…. Looking closer you will see, “I’MPOSSIBLE”…What really matters is your attitude and your perception.
******************************************************

Monday, July 19, 2010

My letter to the freshly passed out job seeker

My advice/guidance which I gave to one of the freshers who has just passed out from BE & is looking out for his first job. Thought of posting this here since it might benefit other freshers as well.


My letter to the freshly passed out job seeker
-----------------------------------------------

Hi,

Please correct the spelling "emplotment" - to employment in your resume. I suggest running a spell check on your resume. It would be better if you can attach a word document format of the doc instead of the pdf.
Also please add more details about your final year projects & any other projects which you had worked on during your academics.

Update these details & re-send the resume to me. I will forward it to my known contacts. But again it can only fetch you interview calls & clearing is fully dependent on how well you perform in the interview.

Here are some pointers for you on how to succeed in getting your first job.

1. Prepare well thoroughly on all the below aspects which I am going to mention. You need to remember that getting an interview call is not your ultimate goal. It is rather to get through the interview & secure the job with full preparation.

2. Typically fresher interviews consist of a written test consisting of below: (for experienced profs it will be telephonic round)
a. Technical questions involving C/C++/Operating system concepts & networking.
b. Puzzles from famous puzzle books from George Summers, Shakuntala Devi
c. Aptitude tests based on books like Barons & Agarwals.

You can prepare for such written test papers from below website. There are lots of other good sites on the internet. Just google them:
http://freshersworld.com/placementweek/papers.asp
http://www.freshers.com/

3. Once you are through with the written test, you will have a face to face interview.
a. Prepare well on concepts from electronics which is your core area based on your academic profile.
b. Prepare well on the concepts in C especially related to Pointers, Data Structures & memory management.
d. Prepare well on C++ OOPS concepts such as inheritence & virtual concepts.
e. Be thorough on the Operating System concpets (Esp. refer to book by Galvin).

Update your corrected/revised resume in below job sites:

Wipro
----------
http://careers.wipro.com/hotjobs/walkin-details.htm
https://synergy.wipro.com/NASApp/com/WiproCareers.jsp?inner=SearchJobs&CompanyCode=WT
http://careers.wipro.com/applying_wipro/index.htm

Infosys
-----------
https://careers.infosys.com/Careerplus/aspx/InternProgram.aspx

TCS
-------
http://careers.tcs.com/CareersDesign/Jsps/CareersHome.jsp

Job consultancy websites (upload your resume here. This will fetch you calls from consultants)
------------------------------
-------------------------------------------------------------------------------------------------------------
www.monsters.com
www.naukri.com
www.timesjobs.com
www.jobsahead.com/

Unfortunately there are no openings for freshers in HP India currently.

Similarly Google for reputed company websites like IBM, Honeywell, CTS, EMC, Dell, Flextronics, Patni, Novell, Oracle & others,

Also, it may so happen that you might end up giving interviews with multiple companies without succeeding which is part of the job search. With each failure you learn as you keep retrying. The Key is not to give up !

All the best for your job search !

Friday, May 1, 2009

Asembling desktop PCs

Gaming - The best ones that I ve played

Console Games.. Woww.. My mind travels back to the 8 bit era where I played the tennis with my uncle & cousin's son for hours together. It was a great game requiring a lot of hand to eye co-ordination & quick reflexes !!

I loved the arcade games such as star galaxy & the car races in the gaming parlors of Mumbai.

It definitely ranks as the best 8 bit game for me ! There were others such as the Baseball.. Super Mario.. Donkey Kong.. & Wrestling to name a few.
A special mention to the Nintendo's F1 racing game which was an all time favorite for me. Also cannot forget the mach rider bike racing game where you could smash your opponent's bike.
We played all this in our Nintendo 8 bit gaming console .

Then cam the 16 bit era where Brian Lara Cricket & The Jungle book were two of the greatest games using which I have spent days on end with my cousins in Mumbai & Bangalore game parlours. We got lucky to get our own SEGA 16 bit gaming console where we could spend some of the most enjoyable summer vacation times.

During the late nineties PC gaming gained a lot of attention as lots of 3D games were being developed for the Windows 98 platform. Of course there were a host of DOS games which I played during 94-96 era such as Dave, pac man, prince of persia, tarzan, Wolfemstien & Aladin.

Then the 3d gaming on windows platform took over the scene. I remember Need for Speed 2 that we played which would give us sheer adrenaline rush just by pressing those keyboard buttons !! NFS2 with mp3 music playing in the background was bliss !!

Cricket 2000 was one of the best game which I enjoyed playing with my bro & my new engineering classmates. There was also the Mortal Combat & Street Fighter games which were there to satisfy our alter egos by kicking & punching the opponents in the game.

Then cam ethe survival horr game series. Shadow Man being one of the most scariest games which Iever played. Hidden & Dangerous & Soldier of Fortune were one of the best war games of early 2000 era.
There was Doom 3D & Quake 3 Arena series providing feed for our shooting game thirst.

The Grand Theft Auto 4 is my latest fling with PC gaming in the recent past since last year.

To be continued.. coming up. the PS2 era experience.

All about the PlayStation 2

I have been a great fan of PC games ever since chilhood. I started with Pac man & Dave on the 386 IBM PC as far as my memory lanes can go back.

Then came Windows workstation 3.1 on which I used to enjoy playing Wolfenstien 3D, Prince of Persia on the Intel's 486 processor.

Then came the Intel's first Intel Pentium processor 586 which my dad bought it for me with 1 GB hdd &amp; 16 MB RAM. :-)
I had a monochrome monitor to start with. The computer service provider had installed Need For Speed 2 game from Electronic Arts in it.

A date with JAVA

Diving into the C

How to Enable Automatic Complete for Cmd Prompt (Cmd.exe)

File name completion and folder name completion are quick-search features of the Windows NT command processor, Cmd.exe. When you type a path or a file name and then press TAB, Cmd.exe searches for all files whose path and file name match your entry.


NOTE: Automatic complete for CMD.exe is not enabled by default in Windows 2000 and later.

When you type a path and then press the TAB key, the command processor searches for all files whose path (but not necessarily the file name) matches your entry. The command processor displays one of the matching file names each time you press TAB. To go backward through the list of file names, press SHIFT+TAB. This article describes how to enable automatic complete for Cmd.exe.

To enable automatic complete for Cmd.exe, use Registry Editor (Regedit) to view the following registry key:
HKEY_CURRENT_USER/Software/Microsoft/Command Processor
Edit the CompletionChar value, and set the value of REG_DWORD to 9. Note that you do not need to restart your computer.

Popular Posts