May
10
Posted by anilezfa on
May 10, 2008
This note is dedicated to my chubby hubby that keep asking me how to remove ^M in a file.
UNIX treats the end of line differently than other operating systems. Normally CTRL-M character is visibly displayed at the end of each line as ^M if the file is not transfered in binary mode (this is why I always prefer SFTP instead of FTP).
- In vi, to remove the ^M do as following :
:%s/^V^M//g
^V is a CONTROL-V character
^M is a CONTROL-M.
So it will look like this:
:%s/^M//g
%s is a basic search and replace command in vi.
The g is use for search and replace globally (all occurrences).
- with Solaris you can just do (heard HPUX has the command “dos2ux” instead of dos2unix):
dos2unix <dos file> <unix file>
- You can also use the octal representatiion of ^M:
tr -d ‘\015\032′ < file
Apr
22
Posted by anilezfa on
April 22, 2008
shmsys:shminfo_shmmax
Maximum shared memory segment size
shmsys:shminfo_shmmin
Minimum shared memory segment size
shmsys:shminfo_shmmni
Number of shared memory identifiers
shmsys:shminfo_shmseg
Number of segments, per process
semsys:seminfo_semmap
Number of entries in the semaphore map
semsys:seminfo_semmni
Number of semaphore identifiers
semsys:seminfo_semmns
Number of semaphores in the system
semsys:seminfo_semmsl
Maximum number of semaphores, per ID
semsys:seminfo_semmnu
Number of processes using the undo facility
semsys:seminfo_semume
Maximum number of undo structures per process
Apr
21
Posted by anilezfa on
April 21, 2008
Useful vi Commands
Cut/Paste Commands:
| x |
delete one character (destructive backspace) |
| dw |
delete the current word (Note: ndw deletes n numbered words) |
| dd |
delete the current line (Note: ndd deletes n numbered lines) |
| D |
delete all content to the right of the cursor |
| d$ |
same as above |
| :u |
undo last command |
| p,P |
paste line starting one line below/above current cursor location |
| J |
combine the contents of two lines |
| "[a-z]nyy |
yank next n lines into named buffer [a-z] |
| "[a-z]p/P |
place the contents of selected buffer below/above the current line |
Apr
19
Posted by anilezfa on
April 19, 2008
I forgot my root password on my linux vmware. Here are the steps that I do in order to reset it.
- Press any key to go to the menu :
Read the rest of this entry »
Apr
11
Posted by anilezfa on
April 11, 2008
In order to reset root password on Solaris box, you would need to do the following :
- Go to OK Prompt by:
<stop> + <a>
or
# init 0
- Once you got the OK prompt, boot into single user mode:
OK> boot cdrom -s
- Mount the root directory, On a typical system, it’s probably c0t0d0s0 or c0t0d0s1:
# mount /dev/dsk/c0t0d0s1 /
- Make a copy of /etc/shadow.
# cp /etc/shadow /etc/shadow.backupcopy
- Edit /etc/shadow file
# vi /etc/shadow
Your /etc/shadow should look like this:
root:<password>::877667
- Delete the password of the root user (Leave the second field empty, dont change anything else):
root:<password>::877667
edit to
root:::877667
- Reboot the box
- Login to root account with no password.