一些简单的Linux命令

来源:互联网 发布:中国网络直播平台排名 编辑:程序博客网 时间:2024/05/18 21:44

这些命令仅是在工作中的linux机器上运行正常的,在其他系统中正常与否有待验证。


ubuntu: sudo apt-get install

GNU/linux: sudo yum install


uname [-amnrsv][--help][--version]

显示系统信息 http://zhidao.baidu.com/question/39995251


pwd

打印当前目录的路径


grep MemTotal /proc/meminfo

显示机器的内存


grep SwapTotal /proc/meminfo

the size of the configured swap space


free

显示内存空间和交换空间


df -k /tmp

显示一个目录下硬盘空间,没有目录的话显示系统


cat /proc/version

查看linux安装的版本


echo $shell

查看当前shell


chmod 777 file/folder

修改文件(夹)权限


zip -r filename.zip folder file

压缩文件到zip中


unzip file_name.zip (-d filepath)

gunzip filename.cpio.gz

解压缩文件(到指定目录)


unzip *.ear

解压缩ear文件

zip与unzip命令详细参考http://www.cnblogs.com/chinareny2k/archive/2010/01/05/1639468.html


jar -cvf <<ear-name>> <<files want to be in the ear >>

产生.ear文件


cp -r[f] folder1 folder2

拷贝文件夹


su username

切换用户


/usr/local/packages/aime/ias/run_as_root (command)

以root身份运行命令

/usr/local/packages/aime/ias/run_as_root "bash" 切换到root


/usr/local/packages/aime/ias/run_as_root "vi /etc/passwd"

更改主目录,将/home/username替换为新设置的主目录


设置变量值:

csh: set ANT_HOME="/scratch/user/Oracle/ant"

set PATH=${PATH}";/home/user" (根据我的经验仅当前shell有效)

bash: export ANT_HOME="/scratch/user/Oracle/ant"

export PATH=$PATH:${ANT_HOME}/bin (跨shell也保留,但是只当前窗口有效)

ANT安装:http://ant.apache.org/manual/install.html


linux下bash中提示符颜色的设置

vi .bashrc

http://sxpspace.blogspot.com/2009/04/shell.html


netstat -nlp

查看端口情况 p程序 l监听socktes n数值的主机端口和用户


ADE中已经安装vnc后:

vncserver 启动vnc

vncpassword 设置密码

~/.vnc/xstartup里可以设置vncserver的属性

vncconfig -nowin& 解决vnc主客机的相互复制问题

vncserver :1 -geometry 1280x960 端口以及分辨率


  1. Start vnc by executing the "vncserver" script.
    vncserver
    VNC will prompt you for a password the first time this script is run. This is the password used to connect to the machine from a vncviewer. I suggest NOT using your SSO password because you may want to share the VNC session with someone.
    By default, the vncserver command starts the window manager not a KDE desktop. Therefore, kill the Xvnc process and then edit the command file as described in the following steps.
  2. ps -ef | grep Xvnc // find the Xvnc process id.
  3. kill <pid>
  4. cd .vnc (notice the DOT in the directory name)
  5. vi xstartup // edit the vnc startup script - emacs is also on the machine if you prefer
  6. change "twm &" to "startkde &" and save the file
  7. Execute the "vncserver" command again. Now a KDE desktop will start (it takes a few minutes).
  8. Using vncviewer // TightVNC download
    connect to the machine. You now have a remote desktop for development.
  9. If you run "konsole &" from the desktop, it gives you as many shells as you want in the same terminal window.

原创粉丝点击