choose language

Custom Search

Saturday 19 February 2011

unix tips, convert man pages to text files, linux tips, solaris tips, How to replace text in multiple files, execute commands at specified times

 Hi
Below some important general unix tips:
  • How to run a command to a set of files (The while read command can handle names with spaces but you need to quote the variable after):
    [unix]$ for i in `ls *mp3`; do cp $i $i.bak; done
    [unix]$ ls *mp3 | while read i; do cp "$i" "$i with more spaces"; done
  • How to rename part of a file:
    [unix]$ echo filename | sed 's/file/another/'
  • How to replace text in multiple files:
    [unix]$ sed -e 's/oldtext/newtext/' -i file1 file2 file3 ...
  • How to delete lines matching a pattern in some files:
    [unix]$ sed -e '/pattern/ d' -i file1 file2 file3 ...
  • How to change all letters to lowercase:
    [unix]$ echo FilENamE | tr A-Z a-z
  • A good way to change all filenames in a directory to lowercase:
    This handles a colored ls (hence the quotes around ls, but you can use any file list output, i.e. find) and names with spaces (hence the while read and not the for).
    [unix]$ "ls" | while read name; do mv "$name" "`echo $name | tr A-Z a-z`"; done
  • How to convert man pages to text files:
    [unix]$ man man | col -b
  • How to list all the open ports and programs:
    [linux]$ netstat -apne --inet
    [freebsd]$ sockstat
  • How to list all the open files and programs:
    [linux]$ lsof
    [freebsd]$ fstat
  • How to find information about an ip (i.e. 10.0.0.0):
    [unix]$ host 10.0.0.0
    [unix]$ dig -x 10.0.0.0
  • How to find information about an ip owner (i.e. 10.0.0.0):
    [unix]$ whois -h whois.arin.net 10.0.0.0
  • How to find out the mailserver for an ip:
    [unix]$ dig mx some.domain.name.net
  • How to generate a filename with yesterdays date (i.e. for logfiles/backups):
    [linux]$ touch logfile-`date -dyesterday '+%Y-%m-%d'`
    [freebsd]$ touch logfile-`date -v-1d '+%Y-%m-%d'`
    
    
Commands/options you should know about, read the man pages
  • tail - display the end of a file
  • head - display the beggining of a file
  • xargs - convert stdin to command line arguments
  • nmap - network scanner
  • watch (linux) - run a command periodically and watch the output
  • watch (freebsd) - monitor a tty
  • lsof - lists the open files
  • strace (linux) - trace the system calls of a program
  • truss (freebsd) - trace the system calls of a program
  • calc - command line calculator program
  • bc - another command line calculator program
  • dc - command line RPN calculator program
  • du - how much disk space is being used by something
  • df - disk free, how much free space there is
  • touch - creates an epty file or updates the timestamp on a file
  • diff - show the difference between 2 files
  • strings - show the strings in a file (useful for binaries)
  • file - tells you what type a file is
  • finger - find out information about users
  • w / who - who is currently on the machine and what are they doing
  • id - tells you who you are
  • uname - tells you basic information about the system.
  • whois - information about hosts
  • crontab - execute commands at specified times
  • last - last users to log into the system
  • mail - very basic mailer, useful for redirection
  • nice/renice - set the niceness ("priority") level of a program
  • nohup - leave a program running after logging off
  • screen - virtual terminal for leaving programs running
  • psnup - print multiple pages in one page
  • time - time the execution of a command
  • wc - word count, tells you the size in bytes, words and lines
  • which / whereis - locates commands
  • locate - locates files
  • whatis - gives brief summary of a comm
  • and
  • wget / fetch - get files off the net
  • talk - chat with other users on the system
  • write / wall - send messages to users of the system
  • zcat - cat gzipped files
  • ln - link files
  • sleep - wait a specified amount of time
  • md5sum (linux) - calculate the md5 signature of a file
  • md5 (freebsd) - calculate the md5 signature of a file
  • enscript - convert text files to ps
  • awk, sed - useful scripting programs
  • cat, echo, more/less, find, grep - you need to know these, it's not an option.

Resource: http://sluglug.ucsc.edu/~isolis/knowledge/unix-tips/

Friday 11 February 2011

Access task manager without control-alt-delete

 Problem:
How to access task manager without control-alt-delete:

solution:

1-Option1:
 right click on an empty area of your taskbar, and clicking on "Task Manager".

2-Option2:
Use the key combination:   Ctrl+Shift+Esc


I hope this helps...

MS Excel adding problem, MS excel Summation problem

Hi and welcome to the new Tip:
Problem:
One of my friends asked me "When i tried to add numbers like 1,2 and 5,5 i get an error message and icannot do it".

Solution:

use the dot instead of the comma  . instead of ,  like this:
1.2+5.5  iinstead of 1,2 +5,5
================================================

Wrong form:













correct form:


fatal error 1603, excel error, Visual studio.net 2005 toolbox

1-Problem:
Visual Studio 2005 -- Error code 1603 for this component means "Fatal error during installation:

example error:
[08/08/07,12:28:44] Microsoft Document Explorer 2005: [2] Error code 1603 for this component means "Fatal error during installation.

solution:

according to my case: i installed previously the Visual studio 2008 and uninstalled it. when i tried to install VS2005 the error 1603 "Fatal error" appeared. i removed all related files of the previous installation using "Add/Remove programs". and then i installed it successfully.


i found alot of other solutions ,it seeems for different-but related problems-, i mentioned them below:


http://support.microsoft.com/kb/834484
http://support.microsoft.com/kb/968749