`
marb
  • 浏览: 419860 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

linux 命令行汇总

 
阅读更多
sudo !!
2009-01-26 10:26:48
User: root
957
Up
Down

Useful when you forget to use sudo for a command. "!!" grabs the last run command.

Comments (33) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
python -m SimpleHTTPServer
2009-02-05 11:57:43
User: pixelbeat
Functions: python
698
Up
Down
 
Comments (24) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
cd -
2009-02-04 22:41:21
User: systemj
Functions: cd
572
Up
Down
 
Comments (15) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
^foo^bar
2009-01-26 13:25:37
User: root
434
Up
Down

Really useful for when you have a typo in a previous command. Also, arguments default to empty so if you accidentally run:

echo "no typozs"

you can correct it with

^z
Comments (8) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
mtr google.com
2009-02-21 07:53:32
User: fryfrog
427
Up
Down

mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.

As mtr starts, it investigates the network connection between the host mtr runs on and HOSTNAME. by sending packets with purposly low TTLs. It continues to send packets with low TTL, noting the response time of the intervening routers. This allows mtr to print the response percentage and response times of the internet route to HOSTNAME. A sudden increase in packetloss or response time is often an indication of a bad (or simply over‐loaded) link.

Show sample output | Comments (13) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
ctrl-x e
2009-03-11 09:26:05
User: fool
384
Up
Down

Next time you are using your shell, try typing ctrl-x e (that is holding control key press x and then e). The shell will take what you've written on the command line thus far and paste it into the editor specified by $EDITOR. Then you can edit at leisure using all the powerful macros and commands of vi, emacs, nano, or whatever.

Show sample output | Comments (14) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
<space>command
2009-03-17 16:25:29
User: eaZy
339
Up
Down

Prepending one or more spaces to your command won't be saved in history.

Useful for pr0n or passwords on the commandline.

Tested on BASH.

Show sample output | Comments (13) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
reset
2009-01-28 22:22:01
User: root
Functions: reset
251
Up
Down

If you bork your terminal by sending binary data to STDOUT or similar, you can get your terminal back using this command rather than killing and restarting the session. Note that you often won't be able to see the characters as you type them.

Show sample output | Comments (11) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
'ALT+.' or '<ESC> .'
2009-03-20 11:36:04
User: atoponce
247
Up
Down

When typing out long arguments, such as:

cp file.txt /var/www/wp-content/uploads/2009/03/

You can put that argument on your command line by holding down the ALT key and pressing the period '.' or by pressing <ESC> then the period '.'. For example:

cd 'ALT+.'

would put '/var/www/wp-content/uploads/2009/03/ as my argument. Keeping pressing 'ALT+.' to cycle through arguments of your commands starting from most recent to oldest. This can save a ton of typing.

Comments (12) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
mount | column -t
2009-03-20 14:18:56
User: thechile
Functions: column mount
231
Up
Down

Particularly useful if you're mounting different drives, using the following command will allow you to see all the filesystems currently mounted on your computer and their respective specs with the added benefit of nice formatting.

Show sample output | Comments (6) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
echo "ls -l" | at midnight
2009-01-25 21:07:42
User: root
Functions: at echo
207
Up
Down

This is an alternative to cron which allows a one-off task to be scheduled for a certain time.

Comments (11) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
dig +short txt <keyword>.wp.dg.cx
2009-07-31 16:08:59
User: drizzt
Functions: dig
204
Up
Down

Query Wikipedia by issuing a DNS query for a TXT record. The TXT record will also include a short URL to the complete corresponding Wikipedia entry.You can also write a little shell script like:

$ cat wikisole.sh

 

#!/bin/sh

 

dig +short txt ${1}.wp.dg.cx

and run it like

./wikisole.sh unix

were your first option ($1) will be used as search term.

Show sample output | Comments (28) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
ssh -N -L2001:localhost:80 somemachine
2009-02-05 09:13:23
Functions: ssh
195
Up
Down

now you can acces the website by going to http://localhost:2001/

Comments (8) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
man ascii
2009-03-31 10:29:20
User: ntheother
Functions: man
183
Up
Down
 
Comments (2) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
curl ifconfig.me
2010-04-21 13:10:33
User: aajjk
176
Up
Down

curl ifconfig.me/ip -> IP Adress

curl ifconfig.me/host -> Remote Host

curl ifconfig.me/ua ->User Agent

curl ifconfig.me/port -> Port

thonks to http://ifconfig.me/

Comments (2) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
!!:gs/foo/bar
2009-02-11 10:20:15
User: Tronks
175
Up
Down

Very useful for rerunning a long command changing some arguments globally.

As opposed to ^foo^bar, which only replaces the first occurrence of foo, this one changes every occurrence.

Comments (6) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp
2009-02-08 10:10:00
User: morpheus
Functions: dd ssh
170
Up
Down

This will output the sound from your microphone port to the ssh target computer's speaker port. The sound quality is very bad, so you will hear a lot of hissing.

Comments (18) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
mount -t tmpfs tmpfs /mnt -o size=1024m
2009-02-06 00:33:08
User: ajrobinson
Functions: mount
165
Up
Down

Makes a partition in ram which is useful if you need a temporary working space as read/write access is fast.

Be aware that anything saved in this partition will be gone after your computer is turned off.

Comments (8) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
sshfs name@server:/path/to/folder /path/to/mount/point
2009-02-05 20:17:41
User: ihasn
162
Up
Down

Install SSHFS from http://fuse.sourceforge.net/sshfs.html

Will allow you to mount a folder security over a network.

Show sample output | Comments (6) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
curl -u user:pass -d status="Tweeting from the shell" http://twitter.com/statuses/update.xml
2009-02-05 18:33:23
User: adamm9
156
Up
Down
 
Comments (20) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com
2009-02-17 22:53:07
User: starchox
Functions: wget
144
Up
Down

-p parameter tells wget to include all files, including images.

-e robots=off you don't want wget to obey by the robots.txt file

-U mozilla as your browsers identity.

--random-wait to let wget chose a random number of seconds to wait, avoid get into black list.

Other Useful wget Parameters:

--limit-rate=20k limits the rate at which it downloads files.

-b continues wget after logging out.

-o $HOME/wget_log.txt logs the output

Comments (5) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
2009-02-04 11:33:19
User: root
Functions: cat diff ssh
143
Up
Down

Useful for checking if there are differences between local and remote files.

Comments (0) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
ctrl-l
2009-03-18 17:38:49
User: mrttlemonde
132
Up
Down
 
Comments (8) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
(cd /tmp && ls)
2009-01-27 00:41:04
User: root
131
Up
Down
 
Comments (14) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
2010-07-23 03:33:46
127
Up
Down

Example :

vim /etc/fstab

## damn

<ctrl+u> sudo <ctrl+y>

## like a boss.

Example 2 :

sudo vim /root/bin/

##uh... autocomplete doesn't work...

<ctrl+u> sudo ls /root/bin

##ah! that's the name of the file!

<ctrl+y> sudo vim /root/bin/ ##resume here! Thanks readline!
Comments (6) | Add to favourites | Report as malicious | Submit alternative | Report as a duplicate
分享到:
评论

相关推荐

    十五个常用Linux命令行总汇

    Linux命令行是Linux系统管理的核心工具,对于任何Linux用户,尤其是管理员来说,掌握常见的命令行操作至关重要。在本文中,我们将深入探讨十五个最常用的Linux命令行,它们可以帮助你更高效地管理和操作Linux系统。 ...

    常见的linux命令行大全汇总

    "常见的Linux命令行大全汇总"这一资源提供了丰富的命令行知识,涵盖了日常使用中的各种场景。下面,我们将对一些重要的Linux命令行进行详细的解释。 1. **ls**:列出目录内容,是Linux中最基本的命令之一。通过`ls ...

    Linux认证:十五个常用Linux命令行总汇.pdf

    Linux命令行是操作Linux系统的主要方式,包含了大量的命令,每个命令都有其特定的功能和选项。本文件介绍了Linux系统中常用的十五个命令,包括chmod、cat、cd、cp、find、grep、ls、mkdir、rm、vi、who、chmod、...

    用Linux命令行实现SQL的groupby

    在IT领域,Linux命令行是系统管理员和开发者们的强大工具,尤其在处理数据和执行自动化任务时。本文将深入探讨如何使用Linux命令行工具来模拟SQL中的`GROUP BY`操作,这对于那些需要对大量文本数据进行分析而无需...

    ubuntu linux命令行简明教程

    ### Ubuntu Linux命令行简明教程知识点汇总 #### 标题:Ubuntu Linux命令行简明教程 - **核心概念**:本教程旨在为Ubuntu Linux的新手用户提供一个全面且实用的指南,帮助他们掌握基本的命令行操作技巧。 - **适用...

    Linux指令命令行汇总大全包括指令说明

    最近都在和Linux打交道,我觉得Linux相比麻烦的地方就是都要用命令来控制,命令比较短小但直接和系统交流,灵活性很高。我将我了解到的命令列举一下,仅供大家参考:Linux指令汇总大全,包括指令说明。

    kali Linux 基本命令行大全

    本文将对 Kali Linux 中的基本命令行进行汇总和说明,涵盖系统信息、文件和目录、文件搜索等多个方面。 一、系统信息 在 Kali Linux 中,可以使用以下命令来查看系统信息: * arch:显示机器的处理器架构 * uname...

    linux 初学资料汇总大全

    总的来说,这份"Linux初学资料汇总大全"是一个全面的起点,涵盖了Linux系统操作、Ubuntu使用以及命令行技能等方面。对于那些希望进入Linux世界的初学者来说,这是一个宝贵的资源,能够帮助他们构建坚实的基础,逐步...

    Linux下5个有趣的命令行技巧介绍.docx

    在Linux操作系统中,命令行是高效工作的重要工具。这篇文档介绍了五个...这些技巧提高了Linux命令行的使用效率,无论是日常使用还是故障排查,都能派上用场。熟悉并掌握这些技巧,将使你在Linux环境下更加游刃有余。

    常用linux命令汇总.rar

    Linux命令行界面(CLI)是其主要交互方式,通过输入命令并回车,可以执行各种操作。以下是一些关键的Linux命令: 1. **ls**:用于列出目录内容。例如,`ls -l`会显示详细信息,包括文件权限、所有者、大小和修改...

    Linux常用命令汇总手册.zip

    对于初学者和专业人士来说,掌握Linux命令行是至关重要的技能。本手册"Linux常用命令汇总手册.zip"提供了全面的Linux命令参考,帮助用户更高效地在终端进行操作。 首先,我们来看一下一些基础的Linux命令: 1. **...

    linux资源包

    Linux命令行是其强大的工具之一,通过各种命令,用户可以执行文件操作、系统管理、网络通信等任务。例如,`ls`用于列出目录内容,`cd`用于切换目录,`mkdir`创建新目录,`rm`删除文件或目录,`cp`和`mv`分别用于复制...

    Linux 操作系统 汇总

    - **shell脚本编程**:如何编写自定义的命令行脚本,使用条件语句、循环结构以及函数。 - **系统管理**:包括用户管理、磁盘管理、备份与恢复策略、日志分析等。 - **系统安全**:防火墙设置、权限控制、 SELinux...

    Linux期末复习(超级详细的 选择、填空、简答、判断、编程等题型总结以及实验和PPT汇总).zip

    2. **填空题**:这可能测试对Linux命令行工具的熟悉程度,如用户和组管理(useradd, groupadd),文件操作(cp, mv, rm),查找文件(find),以及系统状态查询(df, free)。例如,"______命令用于在不同目录之间...

    Linux系统管理工具包系列汇总 Linux系统管理员必看

    存在各种用于简化不同过程的关键实用工具、命令行链和脚本。其中一些工具来自于操作系统,而大部分的诀窍则来源于长期的经验积累和减轻系统管理员工作压力的要求。本系列文章主要专注于最大限度地利用各种Linux环境...

    Linux下C开发汇总资料

    在Linux环境下进行C语言开发是一项基础且重要的技能,涉及到多个工具和...通过GDB调试,GCC编译,熟悉Linux命令行操作,编写有效的Makefile,以及高效地使用VI编辑器,你将在Linux环境下成为一位得心应手的C程序员。

    Linux课件ppt汇总

    进入Linux世界,你需要了解其基本概念,如Shell——这是用户与操作系统交互的命令行界面,例如Bash(Bourne-Again SHell)。学习如何在终端中执行命令、管理文件和目录、权限控制、进程管理等,这些都是日常操作的...

    java开发中常用的linux命令汇总

    Linux命令行提供了高效、强大的工具,可以帮助开发者进行项目管理、调试、系统监控等任务。以下是一些Java开发中常用的Linux命令,它们对于优化开发流程至关重要。 1. **ls**:列出目录内容。`ls -l` 可以查看详细...

    AIX、HP、linux操作系统命令汇总.rar_AIX、HP、linux操作系统命令汇总_linux操作系统_silence7

    本文将深入探讨三个主流的企业级操作系统——AIX、HP-UX(HP)和Linux,它们各自拥有一套丰富的命令行工具,用于系统管理和日常操作。文档"AIX、HP、linux操作系统命令汇总.docx"提供了一个综合性的命令集合,帮助...

Global site tag (gtag.js) - Google Analytics