Showing posts with label Command. Show all posts
Showing posts with label Command. Show all posts

Monday, April 18, 2011

linux命令nc使用实例说明

使用netcat检查服务器的指定的端口是否开通:
root@localhost:~$ nc -z -v 192.168.1.242 80
linux.local [192.168.1.242] 80 (www) open

使用netcat扫描端口:
root@localhost:~$ nc -z -v -w 1 192.168.1.242 1-100
linux.local [192.168.1.242] 80 (www) open
linux.local [192.168.1.242] 22 (ssh) open

使用netcat模拟HTTP请求:
root@localhost:~$ nc www.google.com.hk 80
GET / HTTP/1.1
Host: www.google.com.hk
User-Agent: google-chrome9

HTTP/1.1 200 OK
Date: Mon, 18 Apr 2011 08:56:03 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=Big5
Set-Cookie: PREF=ID=5006f5c292697224:FF=0:NW=1:TM=1303116963:LM=1303116963:S=Lr6ijyXSbmjA6bmZ; expires=Wed, 17-Apr-2013 08:56:03 GMT; path=/; domain=.google.com.hk
Set-Cookie: NID=46=ky6egq_YajJNEzdnM39_2u3CFq2hJLvSVuQm6BokYXSBKhAefFIuL-ZsZOvnDpMISnI2glY25IZxS8_5G0V-EHj-oEc7KRGW4rSZk9yIRnCgsPnm43qhLUMb9hJuKeVW; expires=Tue, 18-Oct-2011 08:56:03 GMT; path=/; domain=.google.com.hk; HttpOnly
Server: gws
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
[......]

Monday, May 24, 2010

linux命令行显示指定行号的内容

以第四行为例,要查询的文件名为list.txt:
方法1:

grep -n '^' list.txt |grep '^4:'|grep -o '[^4:].*'

方法2:
sed -n '4p' list.txt

sed -n '4,4p' list.txt
方法3:
awk '{if ( NR==4 ) print $0}' list.txt

方法4:
tac list.txt |tail -4|tac|tail -1
tac list.txt |tail -n 4|tac|tail -n 1

References: http://zhidao.baidu.com/question/91856742

Wednesday, December 02, 2009

.bashrc中rc的含义说明

rc (像是 ".cshrc" 或 "/etc/rc" 中的 rc 这两个字母) = "RunCom"

"rc" 是取自 "runcom", 来自麻省理工学院在 1965 年发展的 CTSS系统。相关文献曾记载这一段话:
具有从档案中取出一系列命令来执行的功能;这称为 "run commands" 又称为 "runcom",而这种档案又称为一个 runcom (a runcom)。

Sunday, September 27, 2009

svn 批量添加新文件

$> svn status |grep '^\?'|awk -F " " '{print $2}'|xargs svn add

或者是
$> svn st|grep '^\?'|sed 's/^\?\s*//g'|xargs svn add

Sunday, July 12, 2009

linux 基础学习篇一

1973 UNIX
1977 BSD (Bill Joy) -> FreeBSD
1979 AT&T 版权声明
1984 x86 Minix
1984 Richard Mathew Stallman -> GNU & FSF
GPL / LGPL / Apache / BSD / MIT
1991 Linus Torvalds -> Linux

Linux 执行命令
Command [-options] parameters
date -s '2009-09-09 09:09:09'
cal 2009
netstat -a
ps -aux
查看错误信息
google错误信息和example用法
用man/info查说明及用法

keyboard shortcut
Tab
CTRL + C
CTRL + D

Linux 目录和文件相关命令
root
文件权限:所属用户、所属组、其他人
drwxr-xr-x   19        yu            staff   646     Mar 11 18:39 Books
[属性]        [文件数] [所属用户]   [所属组]  [大小]  [修改日期]    [文件名]
mtime 修改时间(modify)
ctime 状态变更时间(change)
atime 访问时间(access)
touch 修改文件的3个时间值
chgrp/chown/chmod

目录相关操作
./../-/~/~yu
pwd/mkdir/rm/ls/cp/mv

文件相关操作
cat/tac/nl/more/less/head/tail
man/more/less 过程中可以按h/H帮助键

Note: This article is published from gmail.

Saturday, December 27, 2008

Tuesday, December 09, 2008

svn:ignore command line

$> svn propset svn:ignore -F .cvsignore .
property 'svn:ignore' set on '.'

Reference: http://svnbook.red-bean.com/en/1.1/ch07s02.html

Thursday, December 04, 2008

find command examples related with file status

空目录
find . -type d -empty

n*24小时前访问过的文件
find . -atime +2

n分钟前状态发生改变的文件
find . -cmin +10

n*24小时前内容有被修改过的文件
find . -mtime +1

n*24小时与(n+1)*24小时这一天中,内容有被修改过的文件(数字n前没有"+"号)
find . -mtime 1

删除find命令找到的文件
find . -cmin 1 -delete

这上面的命令中需要注意一点是其中数字前面需要带上"+"号,才表示这个时间点之前的时间段,如果没有提供"+"号,则指这的就限定在这个时间点内,如这一天内或者这一分钟内。

更多find相关用法可参考http://linux.about.com/od/commands/l/blcmdl1_find.htm

Sunday, October 05, 2008

Firebug command line api 和 console api 中比较常用到的几个方法

1. $(id) 与 prototype 用法类似,只能传字符串的Element Id。
2. $$(selector) 与 prototype 用法类似,传一个CSS Selector字符串,另专门还有一个$x("xPath")方法接受xpath方式查询DOM节点。
3. dir(object) 遍历object所有属性,在console中打印出来。
4. clear() 清空console。
5. debug(fn) 在对应的fn方法第一行加一个断点,当此方法调用时就会进入此方法第一行,可进行断点调试此方法。对应的有undebug(fn)取消断点。

6. console.log(object[, object, ...]),console是Firebug在Firefox中添加的一个全局变量名。其log()方法会将对象打印到firebug控制台中,支持类似printf()的功能。
7. 同console.log()类似的还有console.debug(),console.info(),console.warn(),console.error()方法。
8. console.assert(expression[, object, ...])断言功能,用来检查表达式是否正确执行。

Reference: http://getfirebug.com/commandline.html
http://getfirebug.com/console.html

Thursday, July 31, 2008

Rails Plugins 相关命令

$> script/plugin -h


Usage: plugin [OPTIONS] command
Rails plugin manager.

GENERAL OPTIONS
-r, --root=DIR Set an explicit rails app directory.
Default: /Users/yu/Sites/docbox
-s, --source=URL1,URL2 Use the specified plugin repositories instead of the defaults.
-v, --verbose Turn on verbose output.
-h, --help Show this help message.

COMMANDS
discover Discover plugin repositories.
list List available plugins.
install Install plugin(s) from known repositories or URLs.
update Update installed plugins.
remove Uninstall plugins.
source Add a plugin source repository.
unsource Remove a plugin repository.
sources List currently configured plugin repositories.

EXAMPLES
Install a plugin:
plugin install continuous_builder

Install a plugin from a subversion URL:
plugin install http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder

Install a plugin from a git URL:
plugin install git://github.com/SomeGuy/my_awesome_plugin.git

Install a plugin and add a svn:externals entry to vendor/plugins
plugin install -x continuous_builder

List all available plugins:
plugin list

List plugins in the specified repository:
plugin list --source=http://dev.rubyonrails.com/svn/rails/plugins/

Discover and prompt to add new repositories:
plugin discover

Discover new repositories but just list them, don't add anything:
plugin discover -l

Add a new repository to the source list:
plugin source http://dev.rubyonrails.com/svn/rails/plugins/

Remove a repository from the source list:
plugin unsource http://dev.rubyonrails.com/svn/rails/plugins/

Show currently configured repositories:
plugin sources

Sunday, July 27, 2008

about MasterDispatcher of Tapestry5

在tapestry5中dispatcher是按顺序进行请求分发的,这样才能正确区分请求,而不会使分发器发生混淆,如一个url为:/assets/tapestry5/tapestry.js,这个看上去也像是一个组件请求(for page "assets/tapestry5/tapestry" and component "js"),因此需要确保AssetDispatcher分发器在ComponentAction分发器之前被检查,如果此分发器检查后返回true,则会执行到此分发器为止,返回false则继续执行下一个分发器的检查(参考TapestryModule原代码如下)。
The MasterDispatcher is a chain-of-command of individual Dispatchers, each handling (like a servlet) a particular kind of incoming request.


/**
* RootPath
* Renders the start page for the "/" request
* Asset
* Provides access to classpath assets
* PageRender
* Identifies the PageRenderRequestParameters and forwards onto PageRenderRequestHandler
* ComponentEvent
* Identifies the ComponentEventRequestParameters and forwards onto the ComponentEventRequestHandler
*/
public void contributeMasterDispatcher(OrderedConfiguration configuration,
ObjectLocator locator)
{
// Looks for the root path and renders the start page. This is maintained for compatibility
// with earlier versions of Tapestry 5, it is recommended that an Index page be used instead.

configuration.add("RootPath",
locator.autobuild(RootPathDispatcher.class),
"before:Asset");

// This goes first because an asset to be streamed may have an file extension, such as
// ".html", that will confuse the later dispatchers.

configuration.add("Asset",
locator.autobuild(AssetDispatcher.class), "before:ComponentEvent");


configuration.add("ComponentEvent", locator.autobuild(ComponentEventDispatcher.class),
"before:PageRender");

configuration.add("PageRender",
locator.autobuild(PageRenderDispatcher.class));
}

Friday, February 15, 2008

Usage of linux command: tee

$> ps -ef |grep httpd|tee > grep_result |awk -F " " '{print $1}'|wc -l
其中tee > file是将前面得到的结果打到文件里以方便查看结果。

Sunday, January 20, 2008

usage of cut [awk] and xargs of linux commands

alias dierails='ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -KILL $1'
alias resetrails='ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -HUP $1'

在dzone.com上看到这个命令alias用以杀掉ruby rails server进程,其中的cut结合xargs或者是awk结合xargs使用相当便捷。

Monday, January 07, 2008

Linux Commands Line

Aticle source of Linux Commands Line

COMMAND DESCRIPTION
System information
arch show architecture of machine
uname -r show used kernel version
dmidecode -q show hardware system components - (SMBIOS / DMI)
hdaparm -i /dev/hda displays the characteristics of a hard-disk
hdparm -tT /dev/sda perform test reading on a hard-disk
cat /proc/cpuinfo show information CPU info
cat /proc/interrupts show interrupts
cat /proc/meminfo verify memory use
cat /proc/swaps show file(s) swap
cat /proc/version show version of the kernel
cat /proc/net/dev show network adpters and statistics
cat /proc/mounts show mounted file system(s)
lspci -tv display PCI devices
lsusb -tv show USB devices
date show system date
cal 2007 show the timetable of 2007
date 041217002007.00? set date and time - MonthDayhoursMinutesYear.Seconds
clock -w

save date changes on BIOS
linux commands line v1.1 - LinuxGuide.it
Shutdown, Restart of a system and Logout
shutdown -h now shutdown system
init 0
telinit 0
shutdown -r hours:minutes & planned shutdown of the system
shutdown -c cancel a planned shutdown of the system
shutdown -r now reboot
reboot
logout leaving session
linux commands line v1.1 - LinuxGuide.it
Files and Directory
cd /home enter to directory '/ home'
cd .. go back one level
cd ../.. go back two levels
cd go to home directory
cd ~utente go to home directory
cd - go to previous directory
pwd show the path of work directory
ls view files of directory
ls -F view files of directory
ls -l show details of files and directory
ls -a show hidden files
ls *[0-9]* show files and directory containing numbers
lstree show files and directories in a tree starting from root
mkdir dir1 create a directory called 'dir1'
mkdir dir1 dir2 create two directories simultaneously
mkdir -p /tmp/dir1/dir2 create a directory tree
rm -f file1 delete file called 'file1'
rmdir dir1 delete directory called 'dir1'
rm -rf dir1 remove a directory called 'dir1' and contents recursively
rm -rf dir1 dir2 remove two directories and their contents recursively
mv dir1 new_dir rename / move a file or directory
cp file1 file2 copying a file
cp dir/* . copy all files of a directory within the current work directory
cp -a /tmp/dir1 . copy a directory within the current work directory
cp -a dir1 dir2 copy a directory
ln -s file1 lnk1? create a symbolic link to file or directory
ln file1 lnk1 create a physical link to file or directory
touch -t 0712250000 fileditest modify timestamp of a file or directory - (YYMMDDhhmm)
linux commands line v1.1 - LinuxGuide.it
File search
find / -name file1 search file and directory into root filesystem from '/'
find / -user user1 search files and directories belonging to 'user1'
find /home/user1 -name \*.bin search files with '. bin' extension within directory '/ home/user1'?
find /usr/bin -type f -atime +100 search binary files are not used in the last 100 days
find /usr/bin -type f -mtime -10 search files created or changed within 10 days
find / -name \*.rpm -exec chmod 755 {} ; search files with '.rpm' extension and modify permits
find / -xdev -name \*.rpm search files with? '.rpm' extension ignoring removable partitions as cdrom, pen-drive, etc.…
locate \*.ps find files with the '.ps' extension - first run 'updatedb' command
whereis halt show location of a binary file, source or man
which halt show full path to a binary / executable
linux commands line v1.1 - LinuxGuide.it
Mounting a Filesystem
mount /dev/hda2 /mnt/hda2 mount disk called hda2 - verify existence of the directory '/ mnt/hda2'
umount /dev/hda2 unmount disk called hda2 - exit from mount point '/ mnt/hda2' first
fuser -km /mnt/hda2 force umount when the device is busy
umount -n /mnt/hda2 run umount without writing the file /etc/mtab - useful when the file is read-only or the hard disk is full
mount /dev/fd0 /mnt/floppy mount a floppy disk
mount /dev/cdrom /mnt/cdrom mount a cdrom / dvdrom
mount /dev/hdc /mnt/cdrecorder mount a cdrw / dvdrom
mount /dev/hdb /mnt/cdrecorder mount a cdrw / dvdrom
mount -o loop file.iso /mnt/cdrom mount a file or iso image
mount -t vfat /dev/hda5 /mnt/hda5 mount a Windows FAT32 file system
mount /dev/sda1 /mnt/usbdisk mount a usb pen-drive or flash-drive
mount -t smbfs -o username=user,password=pass //winclient/share /mnt/share mount a windows network share
linux commands line v1.1 - LinuxGuide.it
Disk Space
df -h show list of partitions mounted
ls -lSr |more show size of the files and directories ordered by size
du -sh dir1 estimate space used by directory 'dir1'
du -sh * | sort -rn? show size of the files and directories sorted by size
rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n show space used by rpm packages installed sorted by size (fedora, redhat and like)
dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n show space used by deb packages installed sorted by size (ubuntu, debian and like)
linux commands line v1.1 - LinuxGuide.it
Users and Groups
groupadd group_name create a new group
groupdel group_name delete a group
groupmod -n new_group_name old_group_name rename a group
useradd -c "Nome Cognome" -g admin -d /home/user1 -s /bin/bash user1 create a new user belongs "admin" group
useradd user1 create a new user
userdel -r user1 delete a user ( '-r' eliminates home directory)
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 change user attributes
passwd change password
passwd user1 change a user password (only by root)
chage -E 2005-12-31 user1 set deadline for user password
pwck check correct syntax and file format of '/etc/passwd'? and users existence
grpck check correct syntax and file format of '/etc/group'? and groups existence
newgrp group_name log in to a new group to change default group of newly created files
linux commands line v1.1 - LinuxGuide.it
Permits on File - use "+" to set permissions and "-" to remove
ls -lh show permits
ls /tmp | pr -T5 -W$COLUMNS divide terminal into 5 columns
chmod ugo+rwx directory1 set permissions reading (r), write (w) and (x) access to users owner (u) group (g) and others (o)
chmod go-rwx directory1 remove permits reading (r), write (w) and (x) access to users group (g) and others (or
chown user1 file1 change owner of a file
chown user1 -R directory1 change user owner of a directory and all the files and directories contained inside
chgrp gruppo1 file1 change group of files
chown user1:gruppo1 file1 change user and group ownership of a file
find / -perm -u+s view all files on the system with SUID configured
chmod u+s /bin/file_eseguibile set SUID bit on a binary file - the user that running that file gets same privileges as owner
chmod u-s /bin/file_binario disable SUID bit on a binary file
chmod g+s /home/public set SGID bit on a directory - similar to SUID but for directory
chmod g-s /home/public disable SGID bit on a directory
chmod o+t /home/comune set STIKY bit on a directory - allows files deletion only to legitimate owners
chmod o-t /home/comune disable STIKY bit on a directory
linux commands line v1.1 - LinuxGuide.it
Special Attributes on file - use "+" to set permissions and "-" to remove
chattr +a file1 allows write opening of a file only append mode
chattr +c file1 allows that a file is compressed / decompressed automatically by the kernel
chattr +d file1 makes sure that the program ignores Dump the files during backup
chattr +i file1 makes it an immutable file, which can not be removed, altered, renamed or linked
chattr +s file1 allows a file to be deleted safely
chattr +S? file1 makes sure that if a file is modified changes are written in synchronous mode as with sync
chattr +u file1 allows you to recover the contents of a file even if it is canceled
lsattr show specials attributes
linux commands line v1.1 - LinuxGuide.it
Archives and compressed files
bunzip2 file1.bz2 decompress a file called 'file1.bz2'
bzip2 file1 compress a file called 'file1'
gunzip file1.gz decompress a file called 'file1.gz'
gzip file1 compress a file called 'file1'
gzip -9 file1 compress with maximum compression
rar a file1.rar test_file create an archive rar called 'file1.rar'
rar a file1.rar file1 file2 dir1 compress 'file1', 'file2' and 'dir1' simultaneously
rar x file1.rar decompress rar archive
unrar x file1.rar decompress rar archive
tar -cvf archive.tar file1 create a uncompressed tarball
tar -cvf archive.tar file1 file2 dir1 create an archive containing 'file1', 'file2' and 'dir1'
tar -tf archive.tar show contents of an archive
tar -xvf archive.tar extract a tarball
tar -xvf archive.tar -C /tmp extract a tarball into / tmp
tar -cvfj archive.tar.bz2 dir1 create a tarball compressed into bzip2
tar -xvfj archive.tar.bz2 decompress a compressed tar archive in bzip2
tar -cvfz archive.tar.gz dir1 create a tarball compressed into gzip
tar -xvfz archive.tar.gz decompress a compressed tar archive in gzip
zip file1.zip file1 create an archive compressed in zip
zip -r file1.zip file1 file2 dir1 compress in zip several files and directories simultaneously
unzip file1.zip decompress a zip archive
linux commands line v1.1 - LinuxGuide.it
RPM Packages - Fedora, Red Hat and like
rpm -ivh package.rpm install a rpm package
rpm -ivh --nodeeps package.rpm install a rpm package ignoring dependencies requests
rpm -U package.rpm upgrade a rpm package without changing configuration files
rpm -F package.rpm upgrade a rpm package only if it is already installed
rpm -e package_name.rpm remove a rpm package
rpm -qa show all rpm packages installed on the system
rpm -qa | grep httpd show all rpm packages with the name "httpd"
rpm -qi package_name obtain information on a specific package installed
rpm -qg "System Environment/Daemons" show rpm packages of a group software
rpm -ql package_name show list of files provided by a rpm package installed
rpm -qc package_name show list of configuration files provided by a rpm package installed
rpm -q package_name --whatrequires show list of dependencies required for a rpm packet
rpm -q package_name --whatprovides show capability provided by a rpm package
rpm -q package_name --scripts show scripts started during installation / removal
rpm -q package_name --changelog show history of revisions of a rpm package
rpm -qf /etc/httpd/conf/httpd.conf verify which rpm package belongs to a given file
rpm -qp package.rpm? -l show list of files provided by a rpm package not yet installed
rpm --import /media/cdrom/RPM-GPG-KEY import public-key digital signature
rpm --checksig package.rpm verify the integrity of a rpm package
rpm -qa gpg-pubkey verify integrity of all rpm packages installed
rpm -V package_name check file size, permissions, type, owner, group, MD5 checksum and last modification
rpm -Va check all rpm packages installed on the system - use with caution
rpm -Vp package.rpm verify a rpm package not yet installed
rpm2cpio package.rpm | cpio --extract --make-directories? *bin* extract executable file from a rpm package
rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpm install a package built from a rpm source
rpmbuild --rebuild package_name.src.rpm build a rpm package from a rpm source
linux commands line v1.1 - LinuxGuide.it
YUM packages updater - Fedora, RedHat and like
yum install package_name download and install a rpm package
yum update update all rpm packages installed on the system
yum update package_name upgrade a rpm package
yum remove package_name remove a rpm package
yum list list all packages installed on the system
yum search package_name find a package on rpm repository
yum clean packages clean up rpm cache erasing downloaded packages
yum clean headers remove all files headers that the system uses to resolve dependency
yum clean all remove from the cache packages and headers files
linux commands line v1.1 - LinuxGuide.it
DEB packages - Debian, Ubuntu and like
dpkg -i package.deb install / upgrade a deb package
dpkg -r package_name remove a deb package from the system
dpkg -l show all deb packages installed on the system
dpkg -l | grep httpd show all rpm packages with the name "httpd"
dpkg -s package_name obtain information on a specific package installed on system
dpkg -L package_name show list of files provided by a package installed on system
dpkg --contents package.deb show list of files provided by a package not yet installed
dpkg -S /bin/ping verify which package belongs to a given file
linux commands line v1.1 - LinuxGuide.it
APT packages updater - Debian, Ubuntu e like
apt-get install package_name install / upgrade a deb package
apt-cdrom install package_name install / upgrade a deb package from cdrom
apt-get update update all deb packages installed on system
apt-get remove package_name remove a deb package from system
apt-get check verify correct resolution of dependencies
apt-get clean clean up cache from packages downloaded
linux commands line v1.1 - LinuxGuide.it
View file content
cat file1 view the contents of a file starting from the first row
tac file1 view the contents of a file starting from the last line
more file1 view content of a file along
less file1 similar to 'more' command but which allows backward movement in the file as well as forward movement
head -2 file1 view first two lines of a file
tail -2 file1 view last two lines of a file
tail -f /var/log/messages view in real time what is added to a file
linux commands line v1.1 - LinuxGuide.it
Text Manipulation
cat file_test | [operation: sed, grep, awk, grep, etc] > result.txt syntax to elaborate the text of a file, and write result to a new file
cat file_originale | [operazione: sed, grep, awk, grep, etc] >> result.txt syntax to elaborate the text of a file and append result in existing file
grep Aug /var/log/messages look up words "Aug" on file '/var/log/messages'
grep ^Aug /var/log/messages look up words that begin with "Aug" on file '/var/log/messages'
grep [0-9] /var/log/messages select from file '/var/log/messages' all lines that contain numbers
grep Aug -R /var/log/* search string "Aug" at directory '/var/log' and below
sed 's/stringa1/stringa2/g' example.txt replace "string1" with "string2" in example.txt
sed '/^$/d' example.txt remove all blank lines from example.txt
sed '/ *#/d; /^$/d' example.txt remove comments and blank lines from example.txt
echo 'esempio' | tr '[:lower:]' '[:upper:]' convert from lower case in upper case
sed -e '1d' result.txt eliminates the first line from file example.txt
sed -n '/stringa1/p' view only lines that contain the word "string1"
sed -e 's/ *$//' example.txt remove empty characters at the end of each row
sed -e 's/stringa1//g' example.txt remove only the word "string1" from text and leave intact all
sed -n '1,5p;5q' example.txt view from 1th to 5th row
sed -n '5p;5q' example.txt view row number 5
sed -e 's/00*/0/g' example.txt replace more zeros with a single zero
cat -n file1 number row of a file
cat example.txt | awk 'NR%2==1' remove all even lines from example.txt
echo a b c | awk '{print $1}' view the first column of a line
echo a b c | awk '{print $1,$3}' view the first and third column of a line
paste file1 file2 merging contents of two files for columns
paste? -d? '+' file1 file2 merging contents of two files for columns with '+' delimiter on the center
sort file1 file2 sort contents of two files
sort file1 file2 | uniq sort contents of two files omitting lines repeated
sort file1 file2 | uniq -u sort contents of two files by viewing only unique line
sort file1 file2 | uniq -d sort contents of two files by viewing only duplicate line
comm -1 file1 file2 compare contents of two files by deleting only unique lines from 'file1'
comm -2 file1 file2 compare contents of two files by deleting only unique lines from 'file2'
comm -3 file1 file2 compare contents of two files by deleting only the lines that appear on both files
linux commands line v1.1 - LinuxGuide.it
Character set and Format file conversion
dos2unix filedos.txt fileunix.txt convert a text file format from MSDOS to UNIX
unix2dos fileunix.txt filedos.txt convert a text file format from UNIX to MSDOS
recode ..HTML < page.txt > page.html convert a text file to html
recode -l | more show all available formats conversion
linux commands line v1.1 - LinuxGuide.it
Filesystem Analysis
badblocks? -v? /dev/hda1 check bad blocks in disk hda1
fsck? /dev/hda1 repair / check integrity of linux filesystem on disk hda1
fsck.ext2? /dev/hda1 repair / check integrity of ext2 filesystem on disk hda1
e2fsck? /dev/hda1 repair / check integrity of ext2 filesystem on disk hda1
e2fsck -j /dev/hda1 repair / check integrity of ext3 filesystem on disk hda1
fsck.ext3? /dev/hda1 repair / check integrity of ext3 filesystem on disk hda1
fsck.vfat? /dev/hda1 repair / check integrity of fat filesystem on disk hda1
fsck.msdos? /dev/hda1 repair / check integrity of dos filesystem on disk hda1
dosfsck? /dev/hda1 repair / check integrity of dos filesystems on disk hda1
linux commands line v1.1 - LinuxGuide.it
Format a Filesystem
mkfs /dev/hda1 create a filesystem type linux on hda1 partition
mke2fs /dev/hda1 create a filesystem type linux ext2 on hda1 partition
mke2fs -j /dev/hda1 create a filesystem type linux ext3 (journal) on hda1 partition
mkfs -t vfat 32 -F /dev/hda1 create a FAT32 filesystem
fdformat? -n /dev/fd0 format a floppy disk
mkswap /dev/hda3 create a swap filesystem
linux commands line v1.1 - LinuxGuide.it
SWAP filesystem
mkswap /dev/hda3 create a swap filesystem
swapon /dev/hda3 activating a new swap partition
swapon /dev/hda2 /dev/hdb3? activate two swap partitions
linux commands line v1.1 - LinuxGuide.it
Backup
dump -0aj -f /tmp/home0.bak /home? make a full backup of directory '/home'
dump -1aj -f /tmp/home0.bak /home? make a incremental backup of directory '/home'
restore -if /tmp/home0.bak restoring a backup interactively
rsync -rogpav --delete /home /tmp synchronization between directories
rsync -rogpav -e ssh --delete /home ip_address:/tmp? rsync via SSH tunnel
rsync -az -e ssh --delete ip_addr:/home/public /home/local synchronize a local directory with a remote directory via ssh and compression
rsync -az -e ssh --delete /home/local ip_addr:/home/public synchronize a remote directory with a local directory via ssh and compression
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' make a backup of a local hard disk on remote host via ssh
tar -Puf backup.tar /home/user make a incremental backup of directory '/home/user'
( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' copy content of a directory on remote directory via ssh
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p'? copy a local directory on remote directory via ssh
tar cf - . | (cd /tmp/backup ; tar xf - ) local copy preserving permits and links from a directory to another
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents find and copy all files with '.txt' extention from a directory to another
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2 find all files with '.log' extention and make an bzip archive
dd if=/dev/hda of=/dev/fd0 bs=512 count=1 make a copy of MBR (Master Boot Record) to floppy
dd if=/dev/fd0 of=/dev/hda bs=512 count=1 restore MBR from backup copy saved to floppy
linux commands line v1.1 - LinuxGuide.it
CDROM
cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force clean a rewritable cdrom
mkisofs /dev/cdrom > cd.iso create an iso image of cdrom on disk
mkisofs /dev/cdrom | gzip > cd_iso.gz create a compressed iso image of cdrom on disk
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd create an iso image of a directory
cdrecord -v dev=/dev/cdrom cd.iso burn an ISO image
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - burn a compressed ISO image
mount -o loop cd.iso /mnt/iso mount an ISO image
cd-paranoia -B rip audio tracks from a CD to wav files
cd-paranoia -- "-3" rip first three audio tracks from a CD to wav files
cdrecord --scanbus scan bus to identify the channel scsi
linux commands line v1.1 - LinuxGuide.it
Networking - LAN and WiFi
ifconfig eth0 show configuration of an ethernet network card
ifup eth0 activate an interface 'eth0'
ifdown eth0 disable an interface 'eth0'
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 configure IP Address
ifconfig eth0 promisc configure 'eth0' in promiscuous mode to gather packets (sniffing)
dhclient eth0 active interface 'eth0' in dhcp mode
route -n show routing table
route add -net 0/0 gw IP_Gateway configura default gateway
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 configure static route to reach network '192.168.0.0/16'
route del 0/0 gw IP_gateway remove static route
echo "1" > /proc/sys/net/ipv4/ip_forward activate ip routing
hostname show hostname
host www.linuxguide.it lookup hostname to resolve name to ip address and viceversa
ip link show show link status of all interfaces
mii-tool eth0 show link status of 'eth0'
ethtool eth0 show statistics of network card 'eth0'
netstat -tup show all active network connections and their PID
netstat -tupl show all network services listening on the system and their PID
tcpdump tcp port 80 show all HTTP traffic
iwlist scan show wireless networks
iwconfig eth1 show configuration of a wireless network card
linux commands line v1.1 - LinuxGuide.it
Microsoft Windows networks - SAMBA
nbtscan ip_addr netbios name resolution
nmblookup -A ip_addr netbios name resolution
smbclient -L ip_addr/hostname show remote shares of a windows host
smbget -Rr smb://ip_addr/share like wget can download files from a host windows via smb
mount -t smbfs -o username=user,password=pass //winclient/share /mnt/share mount a windows network share
linux commands line v1.1 - LinuxGuide.it
IPTABLES - firewall
iptables -t filter -L show all chains of filtering table
iptables -t nat -L show all chains of nat table
iptables -t filter -F clear all rules from filtering table
iptables -t nat -F clear all rules from table nat
iptables -t filter -X delete any chains created by user
iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT allow telnet connections to input
iptables -t filter -A OUTPUT -p tcp --dport http -j DROP block HTTP connections to output
iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT allow POP3 connections to forward chain
iptables -t filter -A INPUT -j LOG --log-prefix "DROP INPUT" logging sulla chain di input? Logging on chain input
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE configure a PAT (Port Address Traslation) on eth0 masking outbound packets
iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22 redirect packets addressed to a host to another host
linux commands line v1.1 - LinuxGuide.it
Monitoring and debugging
top display linux tasks using most cpu
ps -eafw displays linux tasks
ps -e -o pid,args --forest displays linux tasks in a hierarchical mode
pstree? mostra un albero dei processi sistema Shows a tree system processes
kill -9 ID_Processo force closure of the process and finish it
kill -1 ID_Processo force a process to reload configuration
lsof -p $$ display a list of files opened by processes
lsof /home/user1 displays a list of open files in a given path system
strace -c ls >/dev/null display system calls made and received by a process
strace -f -e open ls >/dev/null display library calls
watch -n1 'cat /proc/interrupts' display interrupts in real-time
last reboot show history reboot
lsmod display kernel loaded
free -m displays status of RAM in megabytes
smartctl -A /dev/hda monitoring reliability of a hard-disk through SMART
smartctl -i /dev/hda check if SMART is active on a hard-disk
tail /var/log/dmesg show events inherent to the process of booting kernel
tail /var/log/messages show system events
linux commands line v1.1 - LinuxGuide.it
Other useful commands
apropos ...keyword display a list of commands that pertain to keywords of a program , useful when you know what your program does, but you don't know the name of the command
man ping display the on-line manual pages for example on ping command
whatis ...keyword displays description of what a program does
mkbootdisk --device /dev/fd0 `uname -r` create a boot floppy
gpg -c file1 encrypt a file with GNU Privacy Guard
gpg file1.gpg decrypt a file with GNU Privacy Guard
wget -r www.example.com download an entire web site
wget -c www.example.com/file.iso download a file with the ability to stop the download and resume later
echo 'wget -c www.example.com/files.iso' | at 09:00 start a download at any given time
ldd ssh show shared libraries required by ssh program
alias hh='history' set an alias for a command - hh = history

Thursday, December 20, 2007

Vim folding commands

zf#j creates a fold from the cursor down # lines.
zf/string creates a fold from the cursor to string .
zj moves the cursor to the next fold.
zk moves the cursor to the previous fold.
zo opens a fold at the cursor.
zO opens all folds at the cursor.
zm increases the foldlevel by one.
zM closes all open folds.
zr decreases the foldlevel by one.
zR decreases the foldlevel to zero -- all folds will be open.
zd deletes the fold at the cursor.
zE deletes all folds.
[z move to start of open fold.
]z move to end of open fold.

more usage command of vim folding can get from this page.

Saturday, June 09, 2007

Windows XP and DOS[Unix Style Tail Command]

SUMMARY: Display the most recent results of a log file with the tail command for Windows XP

The tail command, on most Unix-style operating systems, lets you display the last 10 or so lines of a text file. It also supports a feature allowing you to keep a file lock on a particular file, displaying new lines as they appear. This is most commonly used for displaying the results of log or debug files, letting you see only the most recent activity of a particular process.

While Windows XP does not normally come with a 'tail' tool, it is available in the Windows 2003 Resource Kit. It is a large download, but besides the 'tail' command, the Windows 2003 Resource Kit also provides tools to remap keys, query the Active Directory, and more. To download and install the Resource Kit:

1. Go to the Microsoft Windows Server 2003 download section at http://www.microsoft.com/windowsserver2003/
downloads/tools/default.mspx. Or, if that link does not work, visit http://www.microsoft.com/ and search for "Windows 2003". Once there, choose the "Downloads -> Tools" link.

2. Select the link "Windows Server 2003 Resource Kit Tools".

3. Click the "Download" link. Choose to register or not, depending on your choice, and follow the on-screen instructions to download and install the product. The default install directory is "C:\Program Files\Windows Resource Kits\Tools\".

Once the Windows 2003 Resource Kit is installed, you may need to reboot your machine for the directory "C:\Program Files\Windows Resource Kits\Tools\" to be added to your path.

Now that the tail command is available, to see the online help, enter the following DOS command:

tail /?

Here is a command summary:

C:\>tail FILENAME

Display the last ten lines from file FILENAME. For example, to see the last ten activities made by the Windows Update tool, issue these commands:

C:\>c:
C:\>cd \windows
C:\>tail "Windows Update.log"

C:\>tail -n FILENAME

Display the last 'n' lines from file FILENAME. For example, view the last 20 lines in the Windows Setup log:

C:\>c:
C:\>cd \windows
C:\>tail -20 setuplog.txt

C:\>tail -f FILENAME

Keep accesing FILENAME, displaying new lines as necessary.

To see this feature in action, open up a new file in Notepad, write the word 'hello, world', and save it as c:\test.log. Keep the file open in Notepad. Now, issue the following DOS commands:

C:\>c:
C:\>cd \
C:\>tail -f test.log

You should see the word 'hello, world' in your DOS prompt. Now, go back to Notepad and write the text "Process executed." Save the file. The DOS prompt should now say "Process executed." Whatever you add to the file in Notepad should then appear in your DOS prompt until you terminate the command.

Monday, February 26, 2007

rm [options] files


rm

rm [options] files

Delete one or more files. To remove a file, you must have write permission in the directory that contains the file, but you need not have permission on the file itself. If you do not have write permission on the file, you will be prompted (y or n) to override. rm is often aliased to rm -i, especially for the root user, to protect against inadvertently deleting files.
Options
-d, --directory

Remove directories, even if they are not empty. Available only to a privileged user.

-f, --force

Remove write-protected files without prompting.

--help

Print a help message and then exit.

-i, --interactive

Prompt for y (remove the file) or n (do not remove the file).

--no-preserve-root

Do not treat root (/) specially. This is the default.

--preserve-root

Do not operate recursively on root (/).

-r, -R, --recursive

If file is a directory, remove the entire directory and all its contents, including subdirectories. Be forewarned: use of this option can be dangerous.

-v, --verbose

Verbose mode (print the name of each file before removing it).

--version

Print version information and then exit.

--

Mark the end of options. Use this when you need to supply a filename beginning with -.

To remove a file whose name starts with a `-', for example `-foo', use one of these commands (the same as `mv' command):

rm -- -foo
rm ./-foo

Sunday, February 11, 2007

MAC OS X 10.4.8 快捷命令

文章来源:远景论坛

苹果机快捷键入门简介


一、开机时按下……
滑鼠按键 弹出抽取式媒介(2.4f1版以前的Boot ROM可能不包括退出CD片)
Option键 在配备「New World」韧体系统的机种上叫出「Open Firmware」开机系统选择功能。
苹果键+Option键 按住这两个键,直到电脑发出二次声响,就会改以Mac OS 9开机。
苹果键+x(有时只按住x键) 如果Mac OS 9和Mac OS X在同一个开机用的硬碟区段(partition)上,按这个键会强迫以OS X开机。
苹果键+Option+shift+delete 跳过原定的启动磁碟,改以外接磁碟(或光碟机)开机。这个按键的主要作用,其实是强迫电脑不要从预设的启动磁碟读入系统档案,所以会产生从其他磁碟开机的「副作用」。如果您的Mac是配备SCSI介面的机种,它会从编号(ID)最高的磁碟机往下搜寻,直到找出可以开机的磁碟区段为止。至於在配备IDE介面的机种上则不确定它的搜寻顺序。
苹果键+Option+shift+delete+# 从指定ID的SCSI磁碟开?#代表SCSI编号)。
苹果键+Option+p+r 清除系统参数记忆体(PRAM),必须按住不放,等发出两次响声之後再放开。
苹果键+Option+n+v 清除NV RAM,类似在Open Firmware中做「重置全部」(reset+all)的动作。
苹果键+Option+o+f 开机时进入open firmware。
苹果键+Option+t+v 强制Quadra AV机种使用外接电视机当作显示器。
苹果键+Option+x+o 以唯读记忆体中所烧录的系统软体开机(仅适用於Mac Classic机种)。
苹果键+Option+a+v 强制电脑辨识苹果AV显示器。
c 使用光碟开机。如果原先设定由OS X开机,但光碟机里没有放置开机光碟,则可能会改由OS 9开机。
d 强制以内建磁碟机开机。
n 按住n键直到萤幕上出现Mac标志,电脑会尝试透过BOOTP或TFTP以网路伺服器开机。
r 强制PowerBook重置萤幕设定。
t 强制配备FireWire介面的机种进入外接磁碟模式(FireWire Target Disk mode)。
shift 关闭所有延伸功能(OS 9或OS X之下的Classic环境)。
shift 关闭登入项目,同时也会关闭所有不必要的程式核心(kernel)延伸功能(也就是所谓安全开机模式,仅适用OS X 10.1.3或更新的系统版本)。
苹果键 开机时关闭虚拟记忆体(Virtual Memory,仅适用OS 9或OS X之下的Classic环境)。
空白键 开机时启动延伸功能管理程式(OS 9或OS X之下的Classic环境)。
苹果键+v 开机过程中显示控制台讯息(仅适用OS X)。
苹果键+s 开机後进入单一使用者模式(仅适用OS X)。
苹果键+Option+c+i 先将系统时钟设定为日期1989年9月20日,然後以这个按键组合开机,就可以看到萤幕上显示特殊的系统小秘密(仅适用於Mac IIci机种)。
苹果键+Option+f+x 先将系统时钟设定为日期1990年3月19日,然後以这个按键组合开机,就可以看到萤幕上显示特殊的系统小秘密(仅适用於Mac IIfx机种)。
二、萤幕上出现小Mac笑脸时按下……
空白键 开机时启动延伸功能管理程式(OS 9或OS X之下的Classic环境)。
shift 关闭包括MacsBug(一种程式设计师工具程式)在内的所有延伸功能(OS 9或OS X之下的Classic环境)。
shift+Option 关闭除了MacsBug之外的所有延伸功能(OS 9或OS X之下的Classic环境)。
Control 中断开机过程,进入MacsBug除错模式。
三、系统画面出现後按下……
苹果键+Option 当OS 9或OS X中的Classic环境连接磁碟机时,可以重建磁碟机的桌面档案。
Option 不要开启任何系统视窗(Mac OS 9)。
shift 在系统档案(Finder)启动时暂时不要开启系统视窗。这些视窗并没有被真的关闭,只要您重新开机,这些视窗都就会照常出现(Mac OS X)。
shift 不要执行任何「启动项目」软体(Mac OS 9)。
--------------------------------------------------------------------------------
四、在系统画面中按下……
按住Option键,再以滑鼠游标
按视窗上的关闭方块 关闭所有的系统视窗(除了弹出式视窗之外);按苹果键+Option+w键也可以获得一样的效果。
苹果键+shift+Option+w 关闭所有的系统视窗(包括弹出式视窗)。
苹果键+右箭头键 在档案视窗以列表模式显示时,开启一个档案夹。
苹果键+Option+右箭头键 在档案视窗以列表模式显示时,重复开启档案夹、以及其下所包含的多层档案夹。
苹果键+左箭头键 在档案视窗以列表模式显示时,关闭一个档案夹。
苹果键+Option+左箭头键 在档案视窗以列表模式显示时,重复关闭档案夹、以及其下所包含的多层档案夹。
苹果键+上箭头键 开启上一层档案夹。在Mac OS X中,如果事先并未选定档案夹、而且没有开启任何视窗,这个按键会开启现在使用者的专属目录。
苹果键+Option+上箭头键 开启上一层档案夹,并关闭现用档案夹。
苹果键+Option+shift+上箭头键 将桌面变成现用视窗,并且选择最上层磁碟机。
苹果键+下箭头键 开启选取的项目。在Mac OS X中,如果事先并未选定档案夹、而且没有开启任何视窗,这个按键会开启桌面档案夹。
苹果键+Option+下箭头键 开启选取的项目,并关闭现用的档案夹。
Option+滑鼠按键 按条列档案视窗中的小三角形图像时,可以显示或隐藏下层档案夹中的内容。
tab键 选择名称以下一个英文字母开头的档案夹。
shift+tab键 选择名称以上一个英文字母开头的档案夹。
苹果键+delete 把选取的项目搬进垃圾桶
五、在系统画面中的「视窗」选单中……
苹果键+选取项目 关闭视窗。
苹果键+shift+选取项目 将弹出式视窗归位。
苹果键+Option+选取项目 展开选取的视窗,并关闭其他所有视窗。
Control+选取项目 展开选取的视窗,并隐藏其他视窗的内容。
•Control+Option+选取项目 启动选取视窗,并展开所有的其他视窗。
六、系统启动完毕之後……
在有电源按钮的机种上
电源按钮 在萤幕上显示包括「关机」、「睡眠」、以及「重新开机」按钮的对话框(请参阅下一节)。
苹果键+Control+电源按钮 强制重新开机。这种方式非必要不建议使用,因为有可能损坏磁碟上的资料内容。
Control+苹果键+Option+电源按钮 快速关机。
苹果键+电源按钮 启动程式除错软体(如果已事先安装的话)。较早期的Mac(例如Mac II时代的机器)需要先安装由Paul Mercer所写的除错延伸功能(debugger init)来使用这个功能;不过这个功能在配备68040处理器的Mac机种上,已经成为系统韧体内容的一部份。
苹果键+Option+电源按钮 让後期型式的PowerBook和桌上型Mac进入睡眠状态。
苹果键+Option+Control+电源按钮 重新设定电源管理程式(Power Manager;仅适用PowerBook 500系列)。
shift+fn+Control+电源按钮 重新设定电源管理程式(Power Manager;仅适用PowerBook G3与G4系列)。
七、在没有电源按钮的机种上
Control+退片按钮 「退片」按钮位於新款USB键盘的最右上角,平常用於退出光碟片。按下这个组合可以在萤幕上显示包括「关机」、「睡眠」、以及「重新开机」按钮的对话框(请参阅下一节)。
苹果键+Control+退片按钮 强制重新开机,正常状况下不建议使用。
Control+苹果键+Option+退片按钮 快速关机。
苹果键+退片按钮 启动程式除错软体(如果已事先安装的话)。较早期的Mac(例如Mac II时代的机器)需要先安装由Paul Mercer所写的除错延伸功能(debugger init)来使用这个功能;不过这个功能在配备68040处理器的Mac机种上,已经成为系统韧体内容的一部份。
苹果键+Option+退片按钮 让後期型式的PowerBook和桌上型Mac进入睡眠状态。
八、在所有机种上
苹果键+Option+esc 强迫退出目前使用中的软体。
苹果键+shift+0 让後期型式的PowerBook与桌上型Mac进入睡眠状态,不过在OS X上不适用。如果在可以配备三部软碟机的Mac机种上(如Mac SE),这个按键可以退出第三部软碟机中的碟片。
苹果键+shift+1或2 弹出内藏或外接软碟机中的碟片。在可以配备两部软碟机的Mac(如Mac SE或Mac II)上,则是依次退出两部软碟机种的碟片。
苹果键+shift+3 拍摄萤幕图片
苹果键+shift+4 拍摄使用者定义的萤幕区域。在Mac OS 9中,如果在选定区域时按下Control键,则拍摄的内容会被储存在记忆体中的剪贴板里,可以直接在其他软体中「贴」上文件。
苹果键+shift+大写固定键+4 如果按下大写固定键(也就是「caps lock」键),则可以拍摄使用者选定的视窗内容(仅适用於Mac OS 9或OS X下的Classic环境)。
苹果键+Control+shift+3 将萤幕图片拍摄至记忆体剪贴板。
苹果键+Control+shift+4 将使用者指定的萤幕区域拍摄至记忆体剪贴板。
苹果键+Control+shift+大写固定键+4 将使用者指定的视窗内容拍摄至记忆体剪贴板(仅适用於Mac OS 9或OS X下的Classic环境)。
苹果键+tab 切换执行中应用软体。
苹果键+space 切换使用的语言系统(如果已安装一种以上的语言系统)。
Option+F3、Option+F4、
或是Option+F5 开启Mac OS X的「系统预置」视窗(仅在「系统预置」尚未执行的时候才有作用)。
苹果键+F1 在Mac OS X中侦测显示器。
苹果键+F2 在Mac OS X中切换萤幕同步显示内容。
F12 退出CD或DVD(在 (在Mac OS X 10.1.2或以上的版本中须按住不放)。如果光碟可以被退出,按这个键就会退出。如果不能退出(例如正在使用中),则按键没有作用。
F14 让萤幕变暗(适用於G4 Cube、iMac G4、或许还有其他机种)。
F15 让萤幕变亮(适用於G4 Cube、iMac G4、或许还有其他机种)。
苹果键+Control+shift+0 在执行Mac OS 9的PowerBook上,强制硬碟停止转动。
Option+「清除垃圾」选单指令 不显示「有档案已经锁住」警示,直接清除垃圾桶内容;锁住的项目也会被删除。

--------------------------------------------------------------------------------
九、在睡眠/重新开机对话框中
S键 睡眠
R键 重新开机
esc键 取消
苹果键+.(英文句号) 取消
Return或Enter键 关机
电源按钮 取消(可能仅适用於Mac OS 9.2.x)
十、在其他对话框中
esc键 取消
苹果键+.(英文句号) 取消
Enter键 预设按钮
Return键 预设按钮(如果同时没有其他文字栏位会用到return键)
苹果键+d 不储存(在储存/□取消/□不储存对话框中)
十一、在有「fn」键的键盘上
fn+backspace 往前删除字元
十二、滑鼠按钮
Optionion+以滑鼠游标按
另一个应用软体的视窗 切换到另一软体,并隐藏现用软体。
苹果键+拖移视窗 拖移视窗,但不将该视窗切换至最前方(该应用软体必须支援视窗在对话框之後运作的功能)。
苹果键+拖移视窗内容 在系统视窗中,利用滑鼠游标来搬动视窗的内容。
苹果键+以游标按视窗标题栏 显示该视窗在硬碟中所在位置的路径(基本上仅适用於系统档案视窗,但某些软体也支援这个功能)。
Optionion+按视窗标题栏
两下以隐藏视窗内容 隐藏所有视窗的内容,仅馀标题栏显示在萤幕上(Mac OS 9或Classic环境)、或将视窗全部隐藏至Dock中(Mac OS X)。
Optionion+视窗标题栏中的
缩放方块 将视窗放大至全萤幕。
Optionion+视窗上的黄色按钮 将所有的软体视窗隐藏在Dock中(仅适用Mac OS X)。
Optionion+视窗上的绿色按钮 将视窗放大至全萤幕(仅适用部份软体)。
十三、仅适用Mac OS X的Dock项目
苹果键+滑鼠按钮 显示项目在系统视窗中的位置。
苹果键+Option+滑鼠按钮 启动某一软体、隐藏其他软体
Control+滑鼠按钮
(或以滑鼠按钮按住项目不放) 显示项目特色选单
苹果键+拖移项目至Dock 停止目前的Dock项目移动,以便将其他文件图像拖移到应用软体图像上。
苹果键+Option+拖移项目至Dock 强制Dock上的软体开启拖移上去的文件。
十四、控制条板
Option+拖移整个控制条板 移动控制条板。
Option+拖移某个控制条板模组 重新安排模组的顺序。
Option+将模组拖移至垃圾桶 解除安装某一模组。
Option+将模组拖移至条板以外的地方 将模组档案拷贝到拖移的位置。