
25条牛逼的LINUX命令之1
As a Linux user you’ll come to learn and love certain commands. Remembering these commands is the toughest part. Some people use cheat-sheets some create scripts, and some just refer to website for their fix. Here I have posted the 25 top command line snippets.
25) sshfs name@server:/path/to/folder /path/to/mount/point
Mount folder/filesystem through SSH
Install SSHFS from http://fuse.sourceforge.net/sshfs.html
Will allow you to mount a folder security over a network.
24) !!:gs/foo/bar
Runs previous command replacing foo by bar every time that foo appears
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.
23) mount | column -t
currently mounted filesystems in nice layout
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.
22) <space>command
Execute a command without saving it in the history
Prepending one or more spaces to your command won’t be saved in history.
Useful for pr0n or passwords on the commandline.
21) ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
Compare a remote file with a local file
Useful for checking if there are differences between local and remote files.
20) mount -t tmpfs tmpfs /mnt -o size=1024m
Mount a temporary ram partition
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.
19) dig +short txt <keyword>.wp.dg.cx
Query Wikipedia via console over DNS
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.
18) netstat -tlnp
Lists all listening ports together with the PID of the associated process
The PID will only be printed if you’re holding a root equivalent ID.
17) dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp
output your microphone to a remote computer’s speaker
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.
16) echo “ls -l” | at midnight
Execute a command at a given time
This is an alternative to cron which allows a one-off task to be scheduled for a certain time.
15) curl -u user:pass -d status=”Tweeting from the shell” http://twitter.com/statuses/update.xml
Update twitter via curl
14) ssh -N -L2001:localhost:80 somemachine
start a tunnel from some machine’s port 80 to your local post 2001
now you can acces the website by going to http://localhost:2001/
13) reset
Salvage a borked terminal
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.
12) ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
Capture video of a linux desktop
11) > file.txt
Empty a file
For when you want to flush all content from a file without removing it (hat-tip to Marc Kilgus).
10) $ssh-copy-id user@host
Copy ssh keys to user@host to enable password-less ssh logins.
To generate the keys use the command ssh-keygen
9) ctrl-x e
Rapidly invoke an editor to write a long, complex, or tricky command
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.
8 ) !whatever:p
Check command history, but avoid running it
!whatever will search your command history and execute the first command that matches ‘whatever’. If you don’t feel safe doing this put :p on the end to print without executing. Recommended when running as superuser.
7) mtr google.com
mtr, better than traceroute and ping combined
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.
6 ) cp filename{,.bak}
quickly backup or copy a file with bash
5) ^foo^bar
Runs previous command but replacing
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
4) cd -
change to the previous working directory
3):w !sudo tee %
Save a file you edited in vim without the needed permissions
I often forget to sudo before editing a file I don’t have write permissions on. When you come to save that file and get the infamous “E212: Can’t open file for writing”, just issue that vim command in order to save the file without the need to save it to a temp file and then copy it back again.
2) python -m SimpleHTTPServer
Serve current directory tree at http://$HOSTNAME:8000/
1) sudo !!
Run the last command as root
Useful when you forget to use sudo for a command. “!!” grabs the last run command.
数据分析咨询请扫描二维码
若不方便扫码,搜微信号:CDAshujufenxi
解析 loss.backward ():深度学习中梯度汇总与同步的自动触发核心 在深度学习模型训练流程中,loss.backward()是连接 “前向计算 ...
2025-09-02要解答 “画 K-S 图时横轴是等距还是等频” 的问题,需先明确 K-S 图的核心用途(检验样本分布与理论分布的一致性),再结合横轴 ...
2025-09-02CDA 数据分析师:助力企业破解数据需求与数据分析需求难题 在数字化浪潮席卷全球的当下,数据已成为企业核心战略资产。无论是市 ...
2025-09-02Power BI 度量值实战:基于每月收入与税金占比计算累计税金分摊金额 在企业财务分析中,税金分摊是成本核算与利润统计的核心环节 ...
2025-09-01巧用 ALTER TABLE rent ADD INDEX:租房系统数据库性能优化实践 在租房管理系统中,rent表是核心业务表之一,通常存储租赁订单信 ...
2025-09-01CDA 数据分析师:企业数字化转型的核心引擎 —— 从能力落地到价值跃迁 当数字化转型从 “选择题” 变为企业生存的 “必答题”, ...
2025-09-01数据清洗工具全景指南:从入门到进阶的实操路径 在数据驱动决策的链条中,“数据清洗” 是决定后续分析与建模有效性的 “第一道 ...
2025-08-29机器学习中的参数优化:以预测结果为核心的闭环调优路径 在机器学习模型落地中,“参数” 是连接 “数据” 与 “预测结果” 的关 ...
2025-08-29CDA 数据分析与量化策略分析流程:协同落地数据驱动价值 在数据驱动决策的实践中,“流程” 是确保价值落地的核心骨架 ——CDA ...
2025-08-29CDA含金量分析 在数字经济与人工智能深度融合的时代,数据驱动决策已成为企业核心竞争力的关键要素。CDA(Certified Data Analys ...
2025-08-28CDA认证:数据时代的职业通行证 当海通证券的交易大厅里闪烁的屏幕实时跳动着市场数据,当苏州银行的数字金融部连夜部署新的风控 ...
2025-08-28PCU:游戏运营的 “实时晴雨表”—— 从数据监控到运营决策的落地指南 在游戏行业,DAU(日活跃用户)、MAU(月活跃用户)是衡量 ...
2025-08-28Excel 聚类分析:零代码实现数据分群,赋能中小团队业务决策 在数字化转型中,“数据分群” 是企业理解用户、优化运营的核心手段 ...
2025-08-28CDA 数据分析师:数字化时代数据思维的践行者与价值推动者 当数字经济成为全球经济增长的核心引擎,数据已从 “辅助性信息” 跃 ...
2025-08-28ALTER TABLE ADD 多个 INDEX:数据库批量索引优化的高效实践 在数据库运维与性能优化中,索引是提升查询效率的核心手段。当业务 ...
2025-08-27Power BI 去重函数:数据清洗与精准分析的核心工具 在企业数据分析流程中,数据质量直接决定分析结果的可靠性。Power BI 作为主 ...
2025-08-27CDA 数据分析师:数据探索与统计分析的实践与价值 在数字化浪潮席卷各行业的当下,数据已成为企业核心资产,而 CDA(Certif ...
2025-08-27t 检验与 Wilcoxon 检验:数据差异比较的两大统计利器 在数据分析中,“比较差异” 是核心需求之一 —— 如新药疗效是否优于旧药 ...
2025-08-26季节性分解外推法:解锁时间序列预测的规律密码 在商业决策、资源调度、政策制定等领域,准确的预测是规避风险、提升效率的关键 ...
2025-08-26CDA 数据分析师:数据治理驱动下的企业数据价值守护者 在数字经济时代,数据已成为企业核心战略资产,其价值的释放离不开高 ...
2025-08-26