RSS
 

Posts Tagged ‘ubuntu’

Ubuntu下将硬盘格式化为ntfs分区

17 Sep
  1. 安装ntfsprogs
    sudo apt-get install ntfsprogs
  2. 使用下面命令中任何一个格式化
    sudo mkfs -t ntfs /dev/sdb1

    sudo mkfs.ntfs /dev/sdb1

    sudo mkntfs /dev/sdb1

    如果需要快速格式化加上-f参数

    sudo mkntfs -f /dev/sdb1
 
No Comments

Posted in linux, ubuntu

 

Ubuntu中的XDMCP客户端

03 Aug

远程登录到linux可以使用VNC或者XDMCP的方式,windows下有一个很有名的XDMCP客户端Xmanager,其实UBuntu下默认也安装了该客户端,一次打开[应用程序]-[internet]-[终端服务客户端(Terminal Server Client)]或者在命令行输入tsclient,在常规标签中的协议选项可以看到XDMCP,只不过是灰色的无法选择,需要先安装协议支持。

$ sudo apt-get install xnest

装完后就可以使用了。

 
No Comments

Posted in linux, ubuntu

 

CentOS 5.3 配置VNC

30 Jul

服务端配置

1.安装VNC Server

$ sudo yum --disablerepo=\* --enablerepo=c5-media vnc-server

2.为用户vangie设置vnc password

$ su - vangie
$ vncpasswd

3.编辑VNC Server配置文件

$ vi /etc/sysconfig/vncservers

修改内容如下:

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my ‘myusername’ (adjust this to your own).  You will also
# need to set a VNC password; run ‘man vncpasswd’ to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use “-nolisten tcp” to prevent X connections to your VNC server via TCP.

# Use “-nohttpd” to prevent web-based VNC clients connecting.

# Use “-localhost” to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the “-via” option in the
# `man vncviewer’ manual page.

# VNCSERVERS=”2:myusername”
# VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp -nohttpd -localhost”

VNCSERVERS=”1:vangie”
VNCSERVERARGS[2]=”-geometry 800×600″

4.创建并编辑xstartup脚本

xstartup脚本会在vncserver第一次启动时创建。

$ sudo /sbin/service vncserver start
$ sudo /sbin/service vncserver stop

编辑xstartup

$ vi .vnc/xstartup

#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#twm &
exec gnome-session &

5.启动VNC Server

$ sudo /sbin/service vncserver start

Ubuntu客户端连接

1.安装VNC客户端

$ sudo apt-get install vncviewer

2.连接服务端

$ vncviewer -bgr233 192.168.18.211:1
 

烦人的easy-share

27 Jul

国内的IP登录easy-share总是要等待500秒,漫长的等待后如果不及时下载又要重新等待,崩溃。

于是在ubuntu下写了一个脚本来提醒自己

首先安装send-notify

sudo apt-get install libnotify-bin

将下面脚本保存为”notifyme”,

#!/bin/bash
sec=$1
msg=$2
if [ -z "$sec" ]
then
sec="500s";
fi

if [ -z "$msg" ]
then
msg="时间到了,赶紧下载吧!";
fi
(sleep $sec && notify-send $msg >/dev/null 2>&1 &)

然后赋予执行权限

chmod 755 notifyme

该命令的执行格式为

notifyme [等时间]  [提醒消息]

 
No Comments

Posted in bash, ubuntu

 

列出系统中所有支持的Shell

26 Jul

Redhat:

$ chsh -l

或者

$ cat /etc/shells

Ubuntu:

$ cat /etc/shells
 

useradd在RedHat和Ubuntu中的差异

26 Jul

linux下使用useradd命令创建一个新用户。

useradd

[-c comment] [-d home_dir]
[-e expire_date] [-f inactive_time]
[-g initial_group] [-G group[,...]]
[-m [-k skeleton_dir] | -M] [-s shell]
[-u uid [ -o]] [-n] [-r] login

该命令在RedHat(CentOS)和Ubuntu中有些小小的差异。

在RedHat下

即使不不使用-m参数,默认也会创建用户主目录,如果想不创建用户主目录,可以使用-M

在Ubuntu下

默认不会创建用户主目录,如果需要创建主目录需要使用-m参数。

也就是说Redhat中默认是-m,而Ubuntu下默认是-M

 

Ubuntu强制卸载ksplice-uptrack

19 Jul

使用常规方法卸载

$ sudo apt-get remove ksplice-uptrack

正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
下列软件包是自动安装的并且现在不再被使用了:
python-decoratortools python-pycurl libyaml-0-1 kerneloops python-yaml
使用’apt-get autoremove’来删除它们
下列软件包将被【卸载】:
ksplice-uptrack
共升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 0 个软件未被升级。
解压缩后将会空出 786kB 的空间。
您希望继续执行吗?[Y/n]y
(正在读取数据库 … 系统当前总共安装有 192832 个文件和目录。)
正在删除 ksplice-uptrack …
You are running an unofficial kernel from the “mainline” PPA:
<http://kernel.ubuntu.com/~kernel-ppa/mainline>.  Ksplice
Uptrack for Ubuntu only supports kernels that were actually released
with Ubuntu Jaunty or one of its official updates.

dpkg:处理 ksplice-uptrack (–remove)时出错:
子进程 pre-removal script 返回了错误号 1
正在处理用于 python-support 的触发器…
在处理时有错误发生:
ksplice-uptrack
E: Sub-process /usr/bin/dpkg returned an error code (1)

无法卸载,使用如下方法可以强制卸载

cd /var/lib/dpkg/info/
sudo rm ksplice-uptrack.*
sudo aptitude purge ksplice-uptrack
sudo aptitude update
sudo aptitude upgrade

参考:[问题]如何强制卸载未正确安装的软件包

 
5 Comments

Posted in ubuntu