User Tools

Site Tools


programming:bash:miscellaneous_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming:bash:miscellaneous_notes [2012/05/09 05:27] sbolayprogramming:bash:miscellaneous_notes [2012/05/09 19:24] (current) – [Installing/Upgrading Software] sbolay
Line 24: Line 24:
 </code> </code>
  
-<note warning>the precedent runlevel will be closed by the new one. That means if the actual runlevel is 5 and you want to go to the runlevel 3 all the user connexions will be closed! See man init for other run level</note>+Warning: the precedent runlevel will be closed by the new one. That means if the actual runlevel is 5 and you want to go to the runlevel 3 all the user connexions will be closed! See man init for other run level.
  
 ==== mount ==== ==== mount ====
Line 1111: Line 1111:
 Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2004-09-17 11:52 CEST Interesting ports on localhost (127.0.0.1): (The 1652 ports scanned but not shown below are in state: closed) Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2004-09-17 11:52 CEST Interesting ports on localhost (127.0.0.1): (The 1652 ports scanned but not shown below are in state: closed)
  
-PORT STATE SERVICE +^PORT  ^STATE  ^SERVICE       ^ 
-22/tcp open ssh +|22/tcp  |open  |ssh           | 
-25/tcp open smtp +|25/tcp  |open  |smtp          | 
-80/tcp open http +|80/tcp  |open  |http          | 
-111/tcp  open rpcbind +|111/tcp |open  |rpcbind       | 
-139/tcp  open netbios-ssn +|139/tcp |open  |netbios-ssn   | 
-445/tcp  open microsoft-ds +|445/tcp |open  |microsoft-ds  | 
-901/tcp  open samba-swat+|901/tcp |open  |samba-swat    | 
 Nmap run completed – 1 IP address (1 host up) scanned in 0.356 seconds Nmap run completed – 1 IP address (1 host up) scanned in 0.356 seconds
  
 to scan the complete network: 192.168.1.0/24 (/24 is equivalent to the subnet mask 255.255.255.0. The calculation is 8bits + 8bits + 8bits + 0bits = 24bits ) to scan the complete network: 192.168.1.0/24 (/24 is equivalent to the subnet mask 255.255.255.0. The calculation is 8bits + 8bits + 8bits + 0bits = 24bits )
  
-netstat +==== netstat ====
 I'don't know now what it does… netstat -acntu I'don't know now what it does… netstat -acntu
  
-nmblookup +==== nmblookup ====
 return the ip adresse given a machineName return the ip adresse given a machineName
- +  * nmblookup “machineName”
-nmblookup “machineName”+
 an equivalent on windows is nbtstat (nbtstat -a “machineName”) an equivalent on windows is nbtstat (nbtstat -a “machineName”)
  
-findsmb +==== findsmb ====
 return all smb client/server in the lan return all smb client/server in the lan
  
-nslookup / dig / host +==== nslookup / dig / host ====
 return the domaine name given the ip and vice-versa return the domaine name given the ip and vice-versa
  
-ifconfig +=== ifconfig ===
 returns the actual settings on localhost (to be used as SU) returns the actual settings on localhost (to be used as SU)
  
 e-mail settings: /etc/postfix/ :This directory containes the majors email configurations files /etc/aliases :This is the aliases file - it says who gets mail for whom. /usr/lib/postfix/ :this directory contains all binaries that are used by an email software /usr/lib/sendmail /usr/sbin/sendmail e-mail settings: /etc/postfix/ :This directory containes the majors email configurations files /etc/aliases :This is the aliases file - it says who gets mail for whom. /usr/lib/postfix/ :this directory contains all binaries that are used by an email software /usr/lib/sendmail /usr/sbin/sendmail
  
-Referer+== Referer == 
 +  * http://www.tldp.org/HOWTO/Net-HOWTO/ 
 +  * http://www.linuxheadquarters.com/howto/networking/networkconfig.shtml
  
-http://www.tldp.org/HOWTO/Net-HOWTO/ +== Other== 
-http://www.linuxheadquarters.com/howto/networking/networkconfig.shtml +  * before configuration, stop networkifdown eth0
-Other:+
  
-before configuration, stop network: ifdown eth0 
 or or
  
-/etc/init.d/network stop +  * /etc/init.d/network stop 
-verify the network module is loaded by issuing /sbin/lsmod +  verify the network module is loaded by issuing /sbin/lsmod 
-activate the eth0 by issuing ifup eth0+  activate the eth0 by issuing ifup eth0 
 or or
  
-/etc/rc.d/init.d/network start+  * /etc/rc.d/init.d/network start 
 /etc/resolv.conf (dns server) /etc/resolv.conf (dns server)
 +  * name server 151.201.0.39 # same as the DNS servers IP in windows ipconfig
  
-name server 151.201.0.39 # same as the DNS servers IP in windows ipconfig 
 /etc/host.conf /etc/host.conf
 +  * order hosts, bind
 +  * multi on
  
-order hosts, bind 
-multi on 
 /etc/hosts /etc/hosts
 +  * 127.0.0.1 localhost loopback
 +  * 192.168.0.1 this.host.name
  
-127.0.0.1 localhost loopback 
-192.168.0.1 this.host.name 
 hostname: hostname:
 +  * /etc/sysconfig/network
  
-/etc/sysconfig/network 
 change IP address permanently change IP address permanently
 +  * ifconfig eth0 %newip%
 +  * vi /etc/sysconfig/network-scripts/ifcfg-eth0 (change ip)
  
-ifconfig eth0 %newip% +===== Shell ===== 
-vi /etc/sysconfig/network-scripts/ifcfg-eth0 (change ip+=== shells === 
-Shell+  * echo $SHELL (what my shell is
 +  * chsh (change shell)
  
-shells+=== Useful keys and how to set them to work === 
 +  * stty -a (to check the list of the current terminal settings) 
 +  * stty erase ^H 
 +  * stty kill ^U 
 +  * unset var_name
  
-echo $SHELL (what my shell is) +=== csh === 
-chsh (change shell) +  * setenv var_name var_value 
-Useful keys and how to set them to work+  * unsetenv var_name
  
-stty -a (to check the list of the current terminal settings) +==== Using EMACS ==== 
-stty erase ^+  * exit: CTRL+XC 
-stty kill ^U +  * help: CTRL+
-unset var_name +  * open file: CTRL+XF (or new file) 
-csh:+  * save file: CTRL+XS 
 +  * save asCTRL+XW
  
-setenv var_name var_value +=== Repaint screen === 
-unsetenv var_name +  * CTRL+l (lowcased L)
-Using EMACS+
  
-exit: CTRL+XC +=== Undo last edit(can be repeated) === 
-help: CTRL+H +  CTRL+/(CTRL+SHIFT+MINUS)
-open file: CTRL+XF (or new file) +
-save file: CTRL+XS +
-save as: CTRL+XW +
-Repaint screen +
- +
-CTRL+l (lowcased L) +
-Undo last edit(can be repeated) +
- +
-CTRL+/(CTRL+SHIFT+MINUS)+
 #Redo last #Redo last
  
-to abort any control or escape sequence+=== to abort any control or escape sequence === 
 +  * CTRL+G
  
-CTRL+G +=== move cursor to line beginning === 
-move cursor to line beginning+  * CTRL+A
  
-CTRL+A +=== move cursor to line end === 
-move cursor to line end+  * CTRL+E
  
-CTRL+E +=== to mark block beginning === 
-to mark block beginning+  * CTRL+@
  
-CTRL+@ +=== cutting the block === 
-cutting the block+  * CTRL+W
  
-CTRL+W +=== pasting the block(can also paste the clipboard from other program) === 
-pasting the block(can also paste the clipboard from other program)+  * CTRL+Y
  
-CTRL+Y +=== copy the block === 
-copy the block+  * ESC+W
  
-ESC+W +=== delete from cursor to line end === 
-delete from cursor to line end +  CTRL+K
- +
-CTRL+K+
 C-s search the document forward for string you name C-r search the document backward for string you name C-s search the document forward for string you name C-r search the document backward for string you name
  
-CVS +==== CVS ====
 remote cvs if using ssh (bash/) To set an environment variable in sh or ksh, use the syntax VAR=value;export VAR, where VAR is the name of the environment variable and value is the value you wish to assign. Do not put spaces on either side of the equals sign. The export command instructs the shell to propagate the value of the variable to all programs that are run by the shell. If an environment variable is reset, but not exported, the change will only apply to the shell itself. remote cvs if using ssh (bash/) To set an environment variable in sh or ksh, use the syntax VAR=value;export VAR, where VAR is the name of the environment variable and value is the value you wish to assign. Do not put spaces on either side of the equals sign. The export command instructs the shell to propagate the value of the variable to all programs that are run by the shell. If an environment variable is reset, but not exported, the change will only apply to the shell itself.
  
 +<code bash>
 [root@localhost root]# CVS_RSH=ssh [root@localhost root]# CVS_RSH=ssh
 [root@localhost root]# export CVS_RSH [root@localhost root]# export CVS_RSH
 [root@localhost root]# echo $CVS_RSH [root@localhost root]# echo $CVS_RSH
 +</code>
 +
 using csh using csh
  
 +<code bash>
 [root@localhost root]# setenv CVS_RSH ssh [root@localhost root]# setenv CVS_RSH ssh
-cvs checkout+</code>
  
 +=== cvs checkout ===
 cvs -d :ext:%username%@%server_domain%:%cvs_root_directory% checkout %modulename% cvs -d :ext:%username%@%server_domain%:%cvs_root_directory% checkout %modulename%
  
-cvs KEY LETTERS +=== cvs KEY LETTERS === 
- +  P: the file has been updated. The P is shown if the file has been added to the repository in the meantime or if it has been changed, but you have not made any changes to this file yourself. 
-P: the file has been updated. The P is shown if the file has been added to the repository in the meantime or if it has been changed, but you have not made any changes to this file yourself. +  U: You have changed this file in the meantime, but nobody else has. 
-U: You have changed this file in the meantime, but nobody else has. +  M: You have changed this file in the meantime, and somebody else has checked in a newer version. All the changes have been merged successfully. 
-M: You have changed this file in the meantime, and somebody else has checked in a newer version. All the changes have been merged successfully. +  C: You have changed this file in the meantime, and somebody else has checked in a newer version. During the merge attempt, conflicts have arisen. 
-C: You have changed this file in the meantime, and somebody else has checked in a newer version. During the merge attempt, conflicts have arisen. +  ?: CVS has no information about this file - that is, this file is not under CVS's control.
-?: CVS has no information about this file - that is, this file is not under CVS's control. +
-Adding action in right clic +
- +
-kde+
  
 +==== Adding action in right clic ====
 +=== kde ===
 for one specific user add in for one specific user add in
 +  * ~/.kde/share/apps/konqueror/servicemenus
  
-~/.kde/share/apps/konqueror/servicemenus 
 or for all users add in or for all users add in
  
-/usr/share/apps/konqueror/servicemenus+  * /usr/share/apps/konqueror/servicemenus 
 a file named openassu.desktop that contains: a file named openassu.desktop that contains:
  
 +<code bash>
 [Desktop Entry] [Desktop Entry]
 ServiceTypes=inode/directory,inode/directory-locked ServiceTypes=inode/directory,inode/directory-locked
Line 1281: Line 1279:
 Icon=kfm Icon=kfm
 Exec=kdesu "konqueror --profile filemanagement %U" Exec=kdesu "konqueror --profile filemanagement %U"
 +</code>
 +
 or another file named runassu.desktop that contains: or another file named runassu.desktop that contains:
  
 +<code bash>
 [Desktop Entry] [Desktop Entry]
 ServiceTypes=application/x-executable,application/x-shellscript,application/x-python,application/x-perl ServiceTypes=application/x-executable,application/x-shellscript,application/x-python,application/x-perl
Line 1294: Line 1295:
 Icon=kfm Icon=kfm
 Exec=kdesu -c Exec=kdesu -c
-gnome+</code>
  
 +=== gnome ===
 Add in directory ~/.gnome2/nautilus-scripts/ a file named “Open\ as\ root” that contains: Add in directory ~/.gnome2/nautilus-scripts/ a file named “Open\ as\ root” that contains:
  
 +<code bash>
 !/bin/sh !/bin/sh
 openas-root: openas-root:
 #nautilus script for opening the selected files as superuser (uid=0), #nautilus script for opening the selected files as superuser (uid=0),
 #utilizing the appropriate applications. #utilizing the appropriate applications.
- +
 for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
 gnome-sudo "gnome-open $uri" & gnome-sudo "gnome-open $uri" &
 done done
 +</code>
 +
 for more information see: http://ubuntuguide.org/#openfilesasrootviarightclick for more information see: http://ubuntuguide.org/#openfilesasrootviarightclick
  
-Installing/Upgrading Software +==== Installing/Upgrading Software ==== 
- +=== upgrading software ===
-upgrading software +
 ldd /usr/bin/X11/xterm (list the shared libraries on which a given executable depends) ldd /usr/bin/X11/xterm (list the shared libraries on which a given executable depends)
  
-using RPM +== using RPM == 
- +  rpm -i SuperFrob-4.i386.rpm (install a new package) 
-rpm -i SuperFrob-4.i386.rpm (install a new package) +  rpm -U SuperFrob-4.i386.rpm (update a package that is already installed) 
-rpm -U SuperFrob-4.i386.rpm (update a package that is already installed) +  rpm -e SuperFrob-5 (uninstall) 
-rpm -e SuperFrob-5 (uninstall) +  rpm -q SuperFrob (find the version number of an installed package) 
-rpm -q SuperFrob (find the version number of an installed package) +  rpm -qa (get a list of all installed package) 
-rpm -qa (get a list of all installed package) +  rpm -qf /usr/bin/dotherpb (find out to which package a file belongs) 
-rpm -qf /usr/bin/dotherpb (find out to which package a file belongs) +  rpm -qi gcc (display information about the specified package) 
-rpm -qi gcc (display information about the specified package) +  rpm -qpl SuperFrob-5.i386.rpm (show the files that will be installed for the specified package file)
-rpm -qpl SuperFrob-5.i386.rpm (show the files that will be installed for the specified package file) +
-using DEB+
  
-deb file:///cdrom/ sarge main +== using DEB == 
-deb http://mirror.switch.ch/ftp/mirror/debian/ stable main +  * deb file:///cdrom/ sarge main // 
-deb-src http://mirror.switch.ch/ftp/mirror/debian/ stable main +  deb http://mirror.switch.ch/ftp/mirror/debian/ stable main 
-deb http://claws.sylpheed.org/debian/ unstable main +  deb-src http://mirror.switch.ch/ftp/mirror/debian/ stable main 
-deb-src http://claws.sylpheed.org/debian/ unstable main +  deb http://claws.sylpheed.org/debian/ unstable main 
-deb http://security.debian.org/ stable/updates main contrib non-free +  deb-src http://claws.sylpheed.org/debian/ unstable main 
-Hardware+  deb http://security.debian.org/ stable/updates main contrib non-free
  
 +==== Hardware ====
 to eject cd tray to eject cd tray
  
 eject -r eject -r
  
-Programming +==== Programming ====
 debug core file debug core file
  
 gdb <programe> <core> gdb <programe> <core>
  
-ERRORS:+==== ERRORS ====
  
-GTK-WARNING XXX:Cannot open display+=== GTK-WARNING XXX:Cannot open display === 
 +== Question == 
 +I'm compiling wxGTK on Redhat Linux 6.1: the following are my step when compiled wxGTK:
  
-Question+  * ./configure 
 +  * make 
 +  * make install 
 +  * ldconfig
  
-I'm compiling wxGTK on Redhat Linux 6.1: the following are my step when compiled wxGTK: 
- 
-./configure 
-make 
-make install 
-ldconfig 
 then edit /etc/ld.so.conf and add /usr/local/lib then I tried to compile calendar application: then edit /etc/ld.so.conf and add /usr/local/lib then I tried to compile calendar application:
  
-make -f makefile.unx+  * make -f makefile.unx 
 when i run calendar application error happend: GTK-WARNING XXX:Cannot open display. What should i do ?. when i run calendar application error happend: GTK-WARNING XXX:Cannot open display. What should i do ?.
  
-Answer+== Answer == 
 +I see 3 cases :
  
-I see 3 cases :+  - You are not directly log on the computer where you run the programme (you do a rlogin or a telnet), in this case you have to set the DISPLAY variable to your computer display (export DISPLAY=mycomputeur.mydomain.org:0) on the remote computer and the X-Server must accept connection from this host (ugly autorisation with xhost : xhost +theremotecomputeur, right config with Mit-Magic-Cookie). 
 +  - You log as user1, and after that you do a su and try to run the program as root. In this case the Xserver is the property of user1 and you try to access it as root, so it refused the connection. solution: run the programme as user1 (good one), or log as root (bad one). 
 +  - Last you dont have an xserver on the computer.
  
-You are not directly log on the computer where you run the programme (you do a rlogin or a telnet), in this case you have to set the DISPLAY variable to your computer display (export DISPLAY=mycomputeur.mydomain.org:0) on the remote computer and the X-Server must accept connection from this host (ugly autorisation with xhost : xhost +theremotecomputeur, right config with Mit-Magic-Cookie). 
-You log as user1, and after that you do a su and try to run the program as root. In this case the Xserver is the property of user1 and you try to access it as root, so it refused the connection. solution: run the programme as user1 (good one), or log as root (bad one). 
-Last you dont have an xserver on the computer. 
 I think in your case the most probable is the 2) I think in your case the most probable is the 2)
programming/bash/miscellaneous_notes.1336541230.txt.gz · Last modified: 2012/05/09 05:27 by sbolay