Archive for Tips and Tricks

How to check your processor is 32 bit or 64 bit (understand /proc/cpuinfo)

In linux systems it is easy to check the cpu information. There is a file named /proc/cpuinfo which contains all the cpu information.

less /proc/cpuinfo

Understanding whether the processor is 32 bit or 64 bit

If you can see  ‘lm’ in the flags section of cpuinfo then your processor is 64 bit. A 32 bit processor dont have this lm flags. All X86-64 cpus have it and no 32 bit cpus dont have it.

Sample output

flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8legacy ts fid vid ttp tm stc

grep flags /proc/cpuinfo

use this command to output only flag section from the cpuinfo, then you can easily check that.

How many physical processors are there?

$ grep ‘physical id’ /proc/cpuinfo | sort | uniq | wc -l
2

How many virtual processors are there?

$ grep ^processor /proc/cpuinfo | wc -l
4

Are the processors dual-core (or multi-core)?

$ grep ‘cpu cores’ /proc/cpuinfo
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2

“2″ indicates the two physical processors are dual-core, resulting in 4 virtual processors.

If “1″ was returned, the two physical processors are single-core. If the processors are single-core, and the number of virtual processors is greater than the number of physical processors, the CPUs are using hyper-threading.

Hyper-threading is supported if ht is present in the CPU flags and you are using an SMP kernel.

Ubuntu Keyboard shortcuts

Ctrl+A = Select all (In Documents, Firefox, Nautilus, etc, not Terminal)

Ctrl+C = Copy (In Documents, Firefox, Nautilus, etc, not Terminal)
Ctrl+V = Paste (In Documents, Firefox, Nautilus, etc, not Terminal)

F9 = Toggle Sidebar
F2 = Rename
Ctrl+Shift+N = Create new folder
Ctrl+N = New (Create a new document, not in terminal)
Ctrl+O = Open (Open a document, not in terminal)
Ctrl+S = Save (Save the current document, not in terminal)
Ctrl+P = Print (Print the current document, not in terminal)

Read more

Apache troubleshooting tips for beginners


As a community supported project, the open source Apache webserver is well-proven, but can still offer an administrator headaches from timeto time when things don’t go quite as planned. In this article, I will provideyou with eight tips to help you solve the most common Apache dilemmas.

Tip #1: Know where to look

If you’re having trouble with Apache, or seeming to havetrouble with one of its modules, your first stop should be in looking overApache’s detailed error log. Depending on how your system and Apache areconfigured, the error log may live in different locations. The default locationfor this file is a file named error_log located in the logs directory insideyour Apache root installation. If you can’t find your error log, open thehttpd.conf configuration file and look for the ErrorLog directive, whichdefines the location.

Apache is initially configured to the “warn” loglevel, meaning that any problem more serious than a warning (critical,emergency, error, alert, and warn) is logged. You can adjust the logging levelin httpd.conf my manipulating the LogLevel directive.

From the Apache documentation, Table A outlines the eightavailable warning levels and provides an example of what would be logged atthat level.

If you can’t figure out why your Apache server is having aproblem, try adjusting the log level to a higher threshold to capture moreinformation. After you change the level, stop and restart your server.

There are actually two log files in Apache: error_log, whichI described in this section, and access_log. The error_log file, as you mightexpect, is the log of most interest for troubleshooting purposes. However, alsomake use of the access_log when looking for problems. This file lists all ofthe items pulled down by clients along with the HTTP error or success code.

Tip #2: Don’t let an AllowOverride ruin your day

Depending on how you want to run your web site, you canselectively alter the behavior of your Apache server by making use of .htaccessfiles. Simply put, an .htaccess file is a file in a directory that lets youmake configuration changes that affect just that folder. For example, if you’vedisabled the “Indexes” in httpd.conf for all directories, none f yourvisitors will be able to access a directory listing. You may have a singlefolder for which this access should be allowed. In this case, you would have an.htaccess file with the “Options Indexes” directive.
Read more