Affichage des articles dont le libellé est LINUX. Afficher tous les articles
Affichage des articles dont le libellé est LINUX. Afficher tous les articles

jeudi 17 juillet 2014

Upload file to remote server using SCP

chenwang@~/Downloads$scp BuildingCocoaApps.pdf wcg1sgh@sgh023118:/home/wcg1sgh/Desktop/
Ubuntu 12.04.4 LTS
wcg1sgh@sgh023118's password:
BuildingCocoaApps.pdf                         100%  653KB 652.9KB/s   00:00

chenwang@~/Downloads$

jeudi 20 septembre 2012

文件权限

ls -l: 查看文件权限

e.g.


chenwang@~/Applications/apache-ode-war-1.3.5/bin$ ls -l
total 32
-rw-r--r--@ 1 chenwang  staff  3005 Jul 22  2011 bpelc
-rwxr-xr-x@ 1 chenwang  staff  2097 Jul 22  2011 bpelc.bat
-rw-r--r--@ 1 chenwang  staff  3017 Jul 22  2011 sendsoap
-rwxr-xr-x@ 1 chenwang  staff  2109 Jul 22  2011 sendsoap.bat


chmod:修改文件权限

e.g. 修改sendsoap script 权限,使得获取执行权限


chenwang@~/Applications/apache-ode-war-1.3.5/bin$ chmod 777 sendsoap
chenwang@~/Applications/apache-ode-war-1.3.5/bin$ ls -l
total 32
-rw-r--r--@ 1 chenwang  staff  3005 Jul 22  2011 bpelc
-rwxr-xr-x@ 1 chenwang  staff  2097 Jul 22  2011 bpelc.bat
-rwxrwxrwx@ 1 chenwang  staff  3017 Jul 22  2011 sendsoap
-rwxr-xr-x@ 1 chenwang  staff  2109 Jul 22  2011 sendsoap.bat

【转】chmod 命令使用


在Unix和Linux的各种操作系统下,每个文件(文件夹也被看作是文件)都按读、写、运行设定权限。
例如我用ls -l命令列文件表时,得到如下输出:
-rw-r--r-- 1 apple users 2254 2006-05-20 13:47 tt.htm
从 第二个字符起rw-是说用户apple有读、写权,没有运行权,接着的r--表示用户组users只有读权限,没有运行权,最后的r--指其他人 (others)只有读权限,没有写权和运行权。这是系统默认设置,我可以改写tt.htm,同组的人和其他人只有权读,没人有权运行,因为只是一个 html文件,不必运行。这在Novell的directory services之前很先进。
读、写、运行三项权限可以用数字表示,就是r=4,w=2,x=1。所以,上面的例子中的rw-r--r--用数字表示成644。
反过来说777就是rwxrwxrwx,意思是该登录用户(可以用命令id查看)、他所在的组和其他人都有最高权限。
再多说一句。我用chmod o-r tt.htm命令改权限,o-r是others的权限中减掉读。结果是
-rw-r----- 1 bu users 2254 2006-05-20 13:47 tt.htm
如果用命令chmod 777 tt.htm,结果是
-rwxrwxrwx 1 bu users 2254 2006-05-20 13:47 tt.htm
任何人都有读、写、运行三项权限。
---------------------------------------------
指令名称 : chmod

  使用权限 : 所有使用者
  使用方式 : chmod [-cfvR] [--help] [--version] mode file...
  说明 : Linux/Unix 的档案存取权限分为三级 : 档案拥有者、群组、其他。利用 chmod 可以藉以控制档案如何被他人所存取。

  参数格式 :

  mode : 权限设定字串,格式如下 : [ugoa...][[+-=][rwxX]...][,...],其中

  u : 表示该档案的拥有者,g 表示与该档案的拥有者属于同一个群体(group)者,o 表示其他以外的人,a 表示这三者皆是。
  + :  表示增加权限、- 表示取消权限、= 表示唯一设定权限。
   r : 表示可读取,w 表示可写入,x 表示可执行,X 表示只有当该档案是个子目录或者该档案已经被设定过为可执行。 -c : 若该档案权限确实已经更改,才显示其更改动作
  -f : 若该档案权限无法被更改也不要显示错误讯息
  -v : 显示权限变更的详细资料
  -R : 对目前目录下的所有档案与子目录进行相同的权限变更(即以递回的方式逐个变更)
  --help : 显示辅助说明

  --version : 显示版本

  范例 :将档案 file1.txt 设为所有人皆可读取 :
  chmod ugo+r file1.txt

  将档案 file1.txt 设为所有人皆可读取 :
  chmod a+r file1.txt

  将档案 file1.txt 与 file2.txt 设为该档案拥有者,与其所属同一个群体者可写入,但其他以外的人则不可写入 :
  chmod ug+w,o-w file1.txt file2.txt

  将 ex1.py 设定为只有该档案拥有者可以执行 :
  chmod u+x ex1.py

  将目前目录下的所有档案与子目录皆设为任何人可读取 :
  chmod -R a+r *

  此外chmod也可以用数字来表示权限如 chmod 777 file

  语法为:chmod abc file

  其中a,b,c各为一个数字,分别表示User、Group、及Other的权限。

  r=4,w=2,x=1

  若要rwx属性则4+2+1=7;
  若要rw-属性则4+2=6;
  若要r-x属性则4+1=7。

  范例:
  chmod a=rwx file 和chmod 777 file效果相同

  chmod ug=rwx,o=x file和chmod 771 file效果相同

  若用chmod 4755 filename可使此程式具有root的权限


dimanche 3 juin 2012

setting primary monitor in Ubuntu

vijayp@ike:~$ xrandr --output HDMI1 --primary
 
In case you don't know what your display is called, just run "xrandr" on its own. This is what my laptop says:

vijayp@ike:~$ xrandr
Screen 0: minimum 320 x 200, current 2880 x 1200, maximum 8192 x 8192
VGA1 disconnected (normal left inverted right x axis y axis)
LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 261mm x 163mm
   1280x800       60.0*+
   1024x768       60.0
   800x600        60.3     56.2
   640x480        59.9
HDMI1 connected 1600x1200+1280+0 (normal left inverted right x axis y axis) 367mm x 275mm
   1600x1200      60.0*+
   1280x1024      75.0     60.0
   1152x864       75.0
   1024x768       75.1     60.0
   800x600        75.0     60.3
   640x480        75.0     60.0
   720x400        70.1
DP1 disconnected (normal left inverted right x axis y axis)

lundi 14 mars 2011

Ubuntu 10.10 安装java(转)

和大多数Linux一样,一般默认安装的Open JDK,如果你只是个上网本,看看电影娱乐啥的,那肯定不用劳神了,不过如果要用JAVA来开发,还是老老实实的安装Sun JDK。还好的是,在Ubuntu 9.04以后,Sun JDK 安装已经越来越简单了。

1. 编辑 /etc/apt/sources.list

添加deb http://archive.canonical.com/ubuntu maverick partner

2. 安装JDK 


Console代码
  1. sudo apt-get update   
  2. sudo apt-get install sun-java6-jdk   

3. 可以在 /etc/jvm 查看默认的 JVM 

4. 添加环境变量

在 /etc/enviroment 中添加环境变量 :


Console代码
  1. PATH="/usr/lib/jvm/java-6-sun/bin:$PATH"  
  2. CLASSPATH="/usr/lib/jvm/java-6-sun/lib"  
  3. JAVA_HOME="/usr/lib/jvm/java-6-sun"  

顺便提一下Ubuntu10.10 里面的环境配置文件:

(1)/etc/enviroment 是系统的环境变量。
(2)/etc/profile: 是所有用户的环境变量。当用户第一次登录时,该文件被执行. 并从/etc/profile.d目录的配置文件中搜集shell的设置。
(3)/etc/bashrc: 为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取。
(4)~/.bash_profile: 每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件。
(5)~/.bashrc: 该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该该文件被读取。
(6) ~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件. 另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承 /etc/profile中的变量,他们是"父子"关系。
(7)~/.bash_profile 是交互式、login 方式进入 bash 运行的~/.bashrc 是交互式 non-login 方式进入 bash 运行的通常二者设置大致相同,所以通常前者会调用后者。

original link: http://hi.baidu.com/insidi/blog/item/090be9d182211a289a502769.html

how to install cplex on unix-based machine

========================
first of all, you have to get
    - the distribution cplex122.x86linux.tar.gz and
    - an authentication file: access_122.ilm.

then, extract the cplex122.x86linux.tar.gz to any path you wish on your computer's disk.

next, set up an environment variable: ILOG_LICENSE_FILE which point to the access_122.ilm file.

up to now, the compiler is installed, you will have the following file structure:

    - <cplex_installed_path>
        - concert27
        - cplex122

to verify the installation:
    - go to <cplex_installed_path>/cplex122/bin/x86_darwin8_gcc4.0/ in the terminal;
    - run ./cplex to start the interactive optimizer.

if you can see the following screen, it means the cplex is well installed:

ILOG CPLEX 11.210, licensed to "inria-grenoble", options: e m b q use=10 MaintenanceEnd=20110330

Welcome to CPLEX Interactive Optimizer 11.2.1
  with Simplex, Mixed Integer & Barrier Optimizers
Copyright (c) ILOG 1997-2008
CPLEX is a registered trademark of ILOG

Type 'help' for a list of available commands.
Type 'help' followed by a command name for more
information on commands.

CPLEX>


===================

how to use cplex with Java

to compile a Java program which calls the cplex:

  javac -classpath /Users/cwang/Documents/workspace/cplex/cplex112.x86_mac/cplex112/lib/cplex.jar:.(pay attention to include the current directory by using :.)

and to execute:

  java -Djava.library.path=/Users/cwang/Documents/workspace/cplex/cplex112.x86_mac/cplex112/bin/x86_darwin8_gcc4.0/libcplex112.so -classpath /Users/cwang/Documents/workspace/cplex/cplex112.x86_mac/cplex112/lib/cplex.jar:. Diet

where the Diet is the name of the program.

mercredi 26 janvier 2011

how to change your mac address in Ubuntu

1: Temporary Modification:
Step 1: check your Mac address.


sudo inconfig


and then, you will see the following lines in your terminal:



eth0      Link encap:Ethernet  HWaddr 00:16:41:e5:7f:1d  
          inet addr:192.168.1.50  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:41ff:fee5:7f1d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:92 errors:0 dropped:0 overruns:0 frame:0
          TX packets:92 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:14966 (14.9 KB)  TX bytes:11325 (11.3 KB)
          Memory:ee000000-ee020000 
lo        Link encap:Local Loopback
...


In this case, your mac address is 00:16:41:e5:7f:1d.


Step 2: Set the Mac address as you wish.


sudo ifconfig eth0 hw ether 00:00:00:00:01:01


Of course, you can use other mac address you want here. Then, enter your password. Afterwards, check the Mac address again, you will see the following in your terminal:



chen@chen-IBM-UBUNTU:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:01:01  
          inet addr:192.168.1.50  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:41ff:fee5:7f1d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4150 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3660 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:4323076 (4.3 MB)  TX bytes:758494 (758.4 KB)
          Memory:ee000000-ee020000 


lo        Link encap:Local Loopback  


To reset/restore your Mac address, you can restart your machine and login again.
DONE.


mercredi 27 octobre 2010

jeudi 21 octobre 2010

[转] Ubuntu 10.04 LTS 安装 sun-java6-jdk

今天需要用到sun的jdk,但找了半天就是找不到,只有openjdk,后来才知道,是10.04中弄走了sun-java6-jdk,官方的release notes 中看
到如下一段:

Sun Java moved to the Partner repository

For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead.
If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Repository. You can configure your system to use this repository via command-line:
add-apt-repository "deb http://archive.canonical.com/ lucid partner"



于是,添加上面的源后再



sudo apt-get update



sudo apt-get install sun-java6-jdk

*原文转自:http://blog.csdn.net/cangzhubai/archive/2010/06/25/5693021.aspx

dimanche 9 mai 2010

[Mac] How to set Environment Variable

1: open a terminal;

2: type "vi ~/.profile";

3: Find a line like:
"export PATH=/opt/local/bin:/opt/local/sbin:$PATH"...

4: Add the path of your java home:
"export PATH=/opt/local/bin:/opt/local/sbin:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin:$PATH"

5: Save and quit.

lundi 9 novembre 2009

Change default document root for Apache 2 in Ubuntu

The default document root for Apache 2 is "/var/www/", if you input "http://localhost/" in your Web browser's URL address, you will get the contents of "index.html" in "/var/www/" directory.

If you want to change this default directory, modify the file "/etc/apache2/sites-available/default" (sudo gedit /etc/apache2/sites-available/default), and then, use the following two commands:

sudo apache2ctl -t

And then

sud apache2ctl restart

ps: sometimes you need to restart your apache server, here is the commands:

sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 restart

vendredi 17 juillet 2009

[转]Ubuntu zgegblog十个漂亮主题

Ubuntu zgegblog十个漂亮主题

2009-06-26 0:25 | 分类 缤纷桌面 | By hfasdwer456
发现自己还真是发烧友,安装要花8 9 个小时 ,然后安装完毕了。
看起来还真是酷,感觉舒服的多了。
但是按官方的安装方法那要花个 8 9个小时啊。
我想了个办法,把我已经安装好的主题拷贝出来,然后大家可以快速下载这样就快多了。
可以下载这个 : zegeblog-themes.zip
这里面有壁纸,有主题,还有登录窗口。
设置登录窗口要把themes文件夹里的主题拷贝到/usr/share/gdm/themes里。

看起来超酷的哦。
下面是官方的图纸
Showtime for Gnome
1

Balanzan
balanzan_pres

Infinity
infinity-pres

Wild shine
wild-pres

Exotic
exotic

Tropical
tropical-prsentation

Bamboo Zen
bamboo-prs

Ubuntu sunrise
ubuntu_presentation

Aqua Dreams
expose
这是官方的安装方法:
添加源
sudo gedit /etc/apt/sources.list
Ubuntu 9.04 Jaunty 用户
  • deb http://ppa.launchpad.net/bisigi/ppa/ubuntu jaunty main
  • deb-src http://ppa.launchpad.net/bisigi/ppa/ubuntu jaunty main
Ubuntu 8.10 Intrpid用户
  • deb http://ppa.launchpad.net/bisigi/ppa/ubuntu intrepid main
  • deb-src http://ppa.launchpad.net/bisigi/ppa/ubuntu intrepid main
添加公钥
  • sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com 1781bd45c4c3275a34bb6aec6e871c4a881574de
更新
  • sudo aptitude update
建议全部安装
  • sudo aptitude install zgegblog-themes
也可以只装一个
  • sudo aptitude install showtime-theme
  • sudo aptitude install balanzan-theme
  • sudo aptitude install infinity-theme
  • sudo aptitude install wild-shine-theme
  • sudo aptitude install exotic-theme
  • sudo aptitude install tropical-theme
  • sudo aptitude install bamboo-zen-theme
  • sudo aptitude install ubuntu-sunrise-theme
  • sudo aptitude install aquadreams-theme
原文地址:http://www.ubuntugeek.com/nice-ubuntu-themes-for-jaunty-and-intrepid-users.html


转载请注明:转自Linux桌面中文网 - Ubuntu zgegblog十个漂亮主题

jeudi 11 juin 2009

[精] Ubuntu 8.04 设置笔记本电脑双显示器 (linux)

Ubuntu 8.04 设置笔记本电脑双显示器

目录:
1、设置显示分辨率及 xrandr 介绍
2、GNOME下切换双屏的方法
3、关于双屏下 GNOME面板/ wine / 阿里旺旺的一些问题及解决

正文:
1、设置显示分辨率及 xrandr 介绍
X Windows 中有一个显示分辨率的概念,在默认情况下,这个显示分辨率为 max*max ,max等于你的所有连接上的显示器中最大分辨率中的最大值。例如我的笔记本液晶屏最大分辨率为 1024*768,外接显示器最大分辨率为 1280*1024,则默认的显示分辨率为 1280*1280。如果我设置左右双屏且使用最大分辨率,那么总显示分辨率就会达到2304*1024,达到超出系统默认的大小。在这种情况下强行设置 双屏幕,就会导致 X 进入超低分辨率,结果不得不手工重设 xrog.conf 来恢复。
为了更好检测这个问题,我们需要用到 xrandr 这个软件,xrandr系统已经自带,如果没有请安装x11-xserver-utils:sudo apt-get install x11-xserver-utils 。
不带参数执行xrandr能够列出当前的显示设备和每个设备支持的模式。Screen代表了总显示区域,VGA代表显示器,LVDS代表笔记本液晶屏。

Screen 0: minimum 320 x 200, current 1280 x 768, maximum 1280 x 1280
VGA connected (normal left inverted right x axis y axis)
1280x1024 75.0 + 69.8 59.9
1024x768 75.1 70.1 60.0
800x600 72.2 75.0 60.3
640x480 75.0 72.8 65.4 60.0
720x400 70.1
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 246mm x 184mm
1024x768 50.0*+ 60.0 40.0
800x600 60.3
640x480 60.0 59.9

系统默认显示分辨率为 1280x1280,而在左右扩展双屏情况下VGA和LVDS支持的最小分辨率加在一起都超过这个数字,当然会导致 X 进入超低分辨率了。如果感兴趣,可以用以下命令尝试把外接显示器打开并设置为右侧扩展屏幕(不用sudo)来验证一下: xrandr --output VGA --auto --right-of LVDS
系统会出错,提升说屏幕大小超出限制。

解决方法:手工修改xorg.conf,在Section "Screen"中添加一行 Virtual 2304 1024

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
SubSection "Display"
Virtual 2304 1024
EndSubSection
EndSection

注意:Ubuntu 8.04中的xorg.conf已经非常精简,Subsection "Display" 可能要自己添加,别忘记 EndSubSection

我设置好以后的xrandr命令输入如下:
$ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2304 x 1024
VGA connected (normal left inverted right x axis y axis)
....
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 246mm x 184mm
....

现在应该没问题了,用刚才的命令打开双屏后,
$ xrandr
Screen 0: minimum 320 x 200, current 2304 x 1024, maximum 2304 x 1024
VGA connected 1280x1024+1024+0 (normal left inverted right x axis y axis) 340mm x 270mm
...
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 246mm x 184mm
...

其实这个显示分辨率完全可以设置高一些,比如我就设置成4000 x 2000,如果连接到最大分辨率为1920x1200的外接显示器,也不用重新设置 xorg.conf 了。

xrandr 命令行可以很方便地切换双屏,常用方式如下,其他的可以自己探索:
xrandr --output VGA --same-as LVDS --auto
打开外接显示器(最高分辨率),与笔记本液晶屏幕显示同样内容(克隆)
xrandr --output VGA --same-as LVDS --mode 1024x768
打开外接显示器(分辨率为1024x768),与笔记本液晶屏幕显示同样内容(克隆)
xrandr --output VGA --right-of LVDS --auto
打开外接显示器(最高分辨率),设置为右侧扩展屏幕
xrandr --output VGA --off
关闭外接显示器
xrandr --output VGA --auto --output LVDS --off
打开外接显示器,同时关闭笔记本液晶屏幕(只用外接显示器工作)
xrandr --output VGA --off --output LVDS --auto
关闭外接显示器,同时打开笔记本液晶屏幕 (只用笔记本液晶屏)
(最后两种情况请小心操作,不要误把两个屏幕都关掉了。。。。)

2、GNOME下切换双屏的方法
用命令行毕竟不方便,幸好我们还有许多 X 下的工具可用:
GNOME 中自带的“监视器屏幕分辨率设置”软件功能很强大(系统->首选项->屏幕分辨率), 打开和关闭第二个监视器的办法是调整它的分辨率,取消“克隆”就可以设置成扩展屏幕,还可以通过拖动图标位置调整双屏时两个屏幕的相对位置。

grandr,则是一个图形界面的xrandr前端,功能与前一个软件各有千秋。安装方法:sudo apt-get install grandr

另外还有两个可以添加到GNOME面板上的快速切换分辨率(但不能切换双屏)的插件,分别是 gnome-randr-applet 和 resapplet,如果你需要可以尝试一下。
对于 Nvidia显卡,据说可以安装 nvidia-settings (sudo apt-get install nvidia-settings),但我没试验过。

3、关于双屏下 GNOME面板/ wine / 阿里旺旺的一些问题及解决
右侧扩展屏幕时,GNOME面板会自动跑到外接显示器上去,可以通过拖动把它放回到笔记本液晶屏上来。
发现一个有趣的现象,用wine执行的程序,似乎只能在最初显示的那个屏幕上显示,拖到另外一个屏幕上就无法正常渲染了。
关于在双屏情况下使用阿里旺旺5.7,有一个注意事项,启动扩展双屏后,再启动阿里旺旺会看不到图标,在托盘区只看到一个空白的图标,无法启动菜单,所以 最好先启动阿里旺旺,然后再启动扩展双屏。(如果已经启动了双屏,那么可以先把双屏模式变成非扩展模式,然后启动旺旺,再打开扩展模式即可)。命令如下:
xrandr --output VGA --same-as LVDS
启动旺旺
xrandr --output VGA --right-of LVDS

关闭笔记本显示器:
xrandr --output LVDS --off(同VGA 相同的操作,只是参数不同)


设置好后Ctrl+Alt+Backspace, 重新加载。

本文转自:
http://i.cn.yahoo.com/shiyufeng/blog/p_40/