氺菓
Linux 基础命令

[mw_shl_code=bash,true]cd

ls

cat

cp

cut

date

df

echo

gzip

tar

mkdir

more

……待续[/mw_shl_code]

明镜若止水
氺菓
tar 压缩 解压命令
展开Biu

压缩:

[mw_shl_code=applescript,true]tar -czf 被压缩目录或文件名路径[/mw_shl_code]

解压:

[mw_shl_code=applescript,true]tar -xf 被解压 压缩包[/mw_shl_code]

说明:

[mw_shl_code=bash,true]-c 建立新的归档文件

-r 向归档文件末尾追加文件

-x 从归档文件中解出文件

-O 将文件解开到标准输出

-v 处理过程中输出相关信息

-f 对普通文件操作

-z 调用gzip来压缩归档文件,与-x联用时调用gzip完成解压缩

-Z 调用compress来压缩归档文件,与-x联用时调用compress完成解压缩[/mw_shl_code]

[查看全文]
氺菓
su 提权命令
展开Biu

[mw_shl_code=bash,true]Usage: su [OPTION]... [-] [USER [ARG]...]

Change the effective user id and group id to that of USER.

-, -l, --login make the shell a login shell

-c, --command=COMMAND pass a single COMMAND to the shell with -c

--session-command=COMMAND pass a single COMMAND to the shell with -c

and do not create a new session

-f, --fast pass -f to the shell (for csh or tcsh)

-m, --preserve-environment do not reset environment variables

-p same as -m

-s, --shell=SHELL run SHELL if /etc/shells allows it

--help display this help and exit

--version output version information and exit

A mere - implies -l. If USER not given, assume root.[/mw_shl_code]

例如:

[mw_shl_code=bash,true]su root[/mw_shl_code]

[查看全文]
氺菓
氺菓回复给帖子:2660431
展开Biu

[mw_shl_code=bash,true]Usage: rm [OPTION]... FILE...

Remove (unlink) the FILE(s).

-f, --force ignore nonexistent files, never prompt

-i, --interactive prompt before any removal

--no-preserve-root do not treat `/' specially (the default)

--preserve-root fail to operate recursively on `/'

-r, -R, --recursive remove directories and their contents recursively

-v, --verbose explain what is being done

--help display this help and exit

--version output version information and exit

By default, rm does not remove directories. Use the --recursive (-r or -R)

option to remove each listed directory, too, along with all of its contents.

To remove a file whose name starts with a `-', for example `-foo',

use one of these commands:

rm -- -foo

rm ./-foo

Note that if you use rm to remove a file, it is usually possible to recover

the contents of that file. If you want more assurance that the contents are

truly unrecoverable, consider using shred.[/mw_shl_code]

[查看全文]
xiayuweiye
不错的楼主
展开Biu

sf。。。不错的楼主、

受教了。。。

[查看全文]
氺菓
rm 删除命令
展开Biu

[mw_shl_code=bash,true]用法:rm [选项]... 文件...

Remove (unlink) the FILE(s).

-f, --force ignore nonexistent files, never prompt

-i, --interactive prompt before any removal

--no-preserve-root 不特殊对待“/”(默认值)

--preserve-root 不允许在“/”上递归操作

-r, -R, --recursive 递归删除目录及其内容

-v, --verbose 详细显示进行的步骤

--help 显示此帮助信息并退出

--version 输出版本信息并退出

默认情况下,rm 不删除目录。使用 --recursive (-r 或 -R)选项可以删除每个列出的

目录及其下面的内容。

要删除第一个字符为“-”的文件 (例如“-foo”),请使用以下其中一种方法:

rm -- -foo

rm ./-foo

请注意,如果使用 rm 来删除文件,通常仍可以将该文件恢复原状。如果想保证

该文件的内容无法还原,请考虑使用 shred。[/mw_shl_code]

[查看全文]
氺菓
氺菓回复给帖子:2660431
展开Biu

[mw_shl_code=bash,true]Usage: cp [OPTION]... [-T] SOURCE DEST

or: cp [OPTION]... SOURCE... DIRECTORY

or: cp [OPTION]... -t DIRECTORY SOURCE...

Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.

-a, --archive same as -dR --preserve=all

--backup[=CONTROL] make a backup of each existing destination file

-b like --backup but does not accept an argument

--copy-contents copy contents of special files when recursive

-d same as --no-dereference --preserve=link

-f, --force if an existing destination file cannot be

opened, remove it and try again

-i, --interactive prompt before overwrite

-H follow command-line symbolic links

-l, --link link files instead of copying

-L, --dereference always follow symbolic links

-P, --no-dereference never follow symbolic links

-p same as --preserve=mode,ownership,timestamps

--preserve[=ATTR_LIST] preserve the specified attributes (default:

mode,ownership,timestamps), if possible

additional attributes: context, links,

xattr, all

-c same as --preserve=context

--no-preserve=ATTR_LIST don't preserve the specified attributes

--parents use full source file name under DIRECTORY

-R, -r, --recursive copy directories recursively

--remove-destination remove each existing destination file before

attempting to open it (contrast with --force)

--sparse=WHEN control creation of sparse files

--strip-trailing-slashes remove any trailing slashes from each SOURCE

argument

-s, --symbolic-link make symbolic links instead of copying

-S, --suffix=SUFFIX override the usual backup suffix

-t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY

-T, --no-target-directory treat DEST as a normal file

-u, --update copy only when the SOURCE file is newer

than the destination file or when the

destination file is missing

-v, --verbose explain what is being done

-x, --one-file-system stay on this file system

-Z, --context=CONTEXT set security context of copy to CONTEXT

--help display this help and exit

--version output version information and exit

By default, sparse SOURCE files are detected by a crude heuristic and the

corresponding DEST file is made sparse as well. That is the behavior

selected by --sparse=auto. Specify --sparse=always to create a sparse DEST

file whenever the SOURCE file contains a long enough sequence of zero bytes.

Use --sparse=never to inhibit creation of sparse files.

The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.

The version control method may be selected via the --backup option or through

the VERSION_CONTROL environment variable. Here are the values:

none, off never make backups (even if --backup is given)

numbered, t make numbered backups

existing, nil numbered if numbered backups exist, simple otherwise

simple, never always make simple backups

As a special case, cp makes a backup of SOURCE when the force and backup

options are given and SOURCE and DEST are the same name for an existing,

regular file.[/mw_shl_code]

[查看全文]
氺菓
文件复制至
展开Biu

[mw_shl_code=bash,true]用法:cp [选项]... [-T] 源 目的

或:cp [选项]... 源... 目录

或:cp [选项]... -t 目录 源...

将<源>文件复制至<目的>,或将多个<源>复制至<目录>。

长选项必须用的参数在使用短选项时也是必须的。

-a, --archive same as -dR --preserve=all

--backup[=CONTROL] make a backup of each existing destination file

-b like --backup but does not accept an argument

--copy-contents copy contents of special files when recursive

-d same as --no-dereference --preserve=link

-f, --force if an existing destination file cannot be

opened, remove it and try again

-i, --interactive prompt before overwrite

-H follow command-line symbolic links

-l, --link 链接文件而不复制

-L, --dereference 总是跟随符号链接

-P, --no-dereference 从不跟随符号链接

-p same as --preserve=mode,ownership,timestamps

--preserve[=ATTR_LIST] preserve the specified attributes (default:

mode,ownership,timestamps), if possible

additional attributes: context, links,

xattr, all

-c same as --preserve=context

--no-preserve=ATTR_LIST don't preserve the specified attributes

--parents use full source file name under DIRECTORY

-R, -r, --recursive 复制目录及目录内的所有项目

--remove-destination 尝试打开目的地文件前先删除已存在的目的地

文件 (与 --force 选项作对比)

--sparse=WHEN control creation of sparse files

--strip-trailing-slashes remove any trailing slashes from each SOURCE

argument

-s, --symbolic-link make symbolic links instead of copying

-S, --suffix=SUFFIX override the usual backup suffix

-t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY

-T, --no-target-directory treat DEST as a normal file

-u, --update 只在<源>文件比目的地文件新,或目的地文件

不存在时才进行复制

-v, --verbose 详细显示进行的步骤

-x, --one-file-system 不会跨越文件系统进行操作

-Z, --context=CONTEXT set security context of copy to CONTEXT

--help 显示此帮助信息并退出

--version 输出版本信息并退出

默认使用模式中,<源>文件是否 sparse 文件会由一种粗略的方式决定,而且相应

的<目的地>文件也会是 sparse 文件。此方式等于使用 --sparse=auto 选项。指定

--sparse=always 则只要<源>文件含有足够长的 0 字节都会产生 sparse 的

<目的地>文件。

使用 --sparse=never 会禁止产生 sparse 文件。

备份文件的后缀为“~”,除非以 --suffix 选项或是 SIMPLE_BACKUP_SUFFIX

环境变量指定。版本控制的方式可透过 --backup 选项或 VERSION_CONTROL 环境

变量来选择。以下是可用的变量值:

none, off 不会进行备份 (即使使用了 --backup 选项)

numbered, t 备份文件会加上数字

existing, nil 若有数字的备份文件已经存在则使用数字,否则使用普通方式备份

simple, never 永远使用普通方式备份

有一个特别情况:如果同时指定 --force 和 --backup 选项,而且<源>和<目的地>

是同一个已存在的一般文件的话,cp 会将<源>文件备份。[/mw_shl_code]

[查看全文]