11 NOT SICK LINUX COMMANDS

2023-11-01

1) CREATE A PDF VERSION OF A MANPAGE

man -t manpage | ps2pdf – filename.pdf

Quick and dirty version. I made a version that checks if a manpage exists (but it’s not a oneliner). You must have ps2pdf and of course Ghostscript installed in your box.

Enhancements appreciated :-)

2) BIND A KEY WITH A COMMAND

bind -x '"/C-l":ls -l'

  
  
the -x option is for binding to a shell command

3) USE FILE(1) TO VIEW DEVICE INFORMATION

file -s /dev/sd*

file(1) can print details about certain devices in the /dev/ directory (block devices in this example). This helped me to know at a glance the location and revision of my bootloader, UUIDs, filesystem status, which partitions were primaries / logicals, etc.. without running several commands.

See also:

file -s /dev/dm-* file -s /dev/cciss/*etc..

4) SINGLE USE VNC-OVER-SSH CONNECTION

ssh -f -L 5900:localhost:5900 your.ssh.server "x11vnc -safer -localhost -nopw -once -display :0";
vinagre localhost:5900

This command

1. SSH into a machine
2. Tunnels VNC port to your local computer (“-L 5900:localhost:5900″)
3. Runs a single use vnc server (“x11vnc -safer -localhost -nopw -once -display :0″)
4. Goes into the background (“-f”)
5. Runs VNC viewer on the local computer connecting to the remote machine via the newly created SSH tunnel (“vinagre localhost:5900″)

5) STOP FLASH FROM TRACKING EVERYTHING YOU DO.

for i in ~/.adobe ~/.macromedia ; do ( rm $i/ -rf ; ln -s /dev/null $i ) ; done

Brute force way to block all LSO cookies on a Linux system with the non-free Flash browser plugin. Works just fine for my needs. Enjoy.

6) A CHILD PROCESS WHICH SURVIVES THE PARENT’S DEATH (FOR SURE)

( command & )

Test scenario:

 

* Open xterm (or konsole, …)

* Start xeyes with: ( xeyes & )

* Close the xterminal

The xeyes process should be still running.

 

7) COMPARE COPIES OF A FILE WITH MD5

cmp file1 file2

8) BACKUP DELICIOUS BOOKMARKS

curl --user login:password -o DeliciousBookmarks.xml -O 'https://api.del.icio.us/v1/posts/all'

 Useful script to backup all your delicious bookmarks. With decilicious shutting down soon , it could be useful

9) RUN A PROGRAM TRANSPARENTLY, BUT PRINT A STACK TRACE IF IT FAILS

gdb -batch -ex “run” -ex “bt” ${my_program} 2>&1 | grep -v ^”No stack.”$

For automated unit tests I wanted my program to run normally, but if it crashed, to add a stack trace to the output log. I came up with this command so I wouldn’t have to mess around with core files.

The one downside is that it does smoosh your program’s stderr and stdout together.

10) BACK SSH FROM FIREWALLED HOSTS

ssh -R 5497:127.0.0.1:22 -p 62220 user@public.ip

host B (you) redirects a modem port (62220) to his local ssh.

host A is a remote machine (the ones that issues the ssh cmd).

once connected port 5497 is in listening mode on host B.

host B just do a

ssh 127.0.0.1 -p 5497 -l user

and reaches the remote host’ssh. This can be used also for vnc and so on.

11) RENAME HTML FILES ACCORDING TO THEIR TITLE TAG

perl -wlne'/title>([^<]+)/i&&rename$ARGV,"$1.html"' *.html

The above one-liner could be run against all HTML files in a directory. It renames the HTML files based on the text contained in their title tag. This helped me in a situation where I had a directory containing thousands of HTML documents with meaningless filenames.

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

11 NOT SICK LINUX COMMANDS 的相关文章

  • 如何使用 C# 将标签/关键字添加到 Windows 文件属性详细信息选项卡

    理想情况下 我想使用 shell 类将标签添加到我的 Office 文档中 但我认为这样 tag 属性是只读项目 有人还有其他办法吗 关于这个主题的内容很少 感谢您的帮助 我进一步研究了 shellfile 类 答案就在我眼前 string
  • 在 Bootstrap 按钮下拉列表标题/占位符文本中显示所选项目

    这个问题已经在 Stackoverflow 上被问过几次了 但是我仍然无法弄清楚它的真相 而且我的查询正在抛出更多的下拉菜单 所以我有两个下拉菜单和一个搜索 我想从下拉列表和 选定 中进行选择以替换下拉占位符文本 但我还需要记住 点击搜索后
  • 转换为 PDF 后,Flex 布局中的 HTML 表格变得重叠

    尝试使用将 html 文件转换为 pdfweasyprint 但由于bug https github com Kozea WeasyPrint issues 1805 in weasyprint 我不能使用flex布局 因为它与第一行中的两
  • 获取要在新浏览器中显示的选择值

    嘿 基本上这是我的代码 运行的第一个脚本允许在 URL 中显示所选值
  • 文本区域下的额外填充

    我的文本区域下面有额外的填充 但我似乎找不到它的来源 我已将单独的代码放在此页面上 http jsfiddle net wfuks http jsfiddle net wfuks 我似乎找不到它的来源 它有类 field field bac
  • just_audio 无法在 ios flutter 上工作未处理的异常:(-11800)操作无法完成

    我正在尝试从它自己的存储库运行 just audio 示例项目https github com ryanheise just audio tree master just audio example https github com rya
  • html 音频标签,持续时间总是无穷大

    我一直在研究使用 html 音频标签来播放一些音频文件 音频播放正常 但音频标签的持续时间属性始终返回无穷大 我尝试了接受的答案this https stackoverflow com questions 16849023 html5 au
  • 如何安装 Node 和 NPM 以便不必使用 sudo?

    我正在尝试在 Ubuntu 14 04 计算机上设置 Node js 和 NPM 但遇到了一些问题 在我的第一次尝试中 我不断得到EACCES尝试安装软件包时出错 有时甚至使用sudo 所以我彻底卸载了node和npm 现在我正在尝试找出如
  • 使用 XPath 获取内部有链接的段落文本

    我正在使用 XPath 解析 HTML 页面 并希望获取某些特定段落的完整文本 包括链接文本 例如我有以下段落 p class main content This is sample paragraph with a href http g
  • 从 firebase 数据库获取最高分值

    在我的网站上有一些我从 firebase 获得的电影 电影的分数在0到100之间 我已经在我的网站上找到了所有电影 我还想按降序显示它们 例如评分最高的 5 部电影 我怎样才能实现这一点 感谢您的回答 const app initializ
  • 为什么Disabled = true对于html有效?

    我注意到我们的代码中有一个disabled ture 我是锚标签的源代码 我想知道为什么它在 IE 中有效 我也在互联网上进行了搜索 通过网络搜索 它也被用于很多源代码中 我一直在搜索if ture 拼写错误的true也可以被IE使用 有人
  • 使用过渡添加子项时 div 的平滑增长

    尽管使用了以下代码 但其行为并不符合我的预期transition所以可能有些事情我不明白 理想情况下 单击该按钮会将一个子项添加到id2div 并制作id1分区增长smoothly因此 function id1 button click g
  • 使用时间序列数据和scaleBand指定D3条形图上的刻度

    我尝试为具有时间序列数据的 d3 v4 条形图指定多个刻度和多个刻度标签 如下图所示 基于本教程 https bl ocks org zigahertz 1ee4965ff76514517bb7ce6af21e5d44我有一个处理时间序列数
  • 下拉菜单导致滚动条

    我用过这个W3C 的示例 http www w3schools com bootstrap bootstrap dropdowns asp div class dropdown div
  • html5 vs flash - 完整的比较图表在哪里? [关闭]

    Closed 此问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 因此 自从史蒂夫 乔布斯说 Flash 很糟糕并暗示 HTML5 可以完成 Flash 可以做的所有事情
  • 适用于 HTML5 混合应用程序的 CORS

    我读过很多关于 CORS 的文章 以及允许 Access Control Allow Origin 如何成为 Web 服务器的安全漏洞 但没有一篇文章解释了如何允许 HTML5 混合应用程序访问某些不允许使用通配符 的域上托管的 Web 服
  • 为什么在setsid()之前fork()

    Why fork before setsid 守护进程 基本上 如果我想将一个进程与其控制终端分离并使其成为进程组领导者 我使用setsid 之前没有分叉就这样做是行不通的 Why 首先 setsid 将使您的进程成为进程组的领导者 但它也
  • CSS交付优化:如何推迟CSS加载?

    我在尝试着优化 CSS 交付遵循针对开发人员的谷歌文档https developers google com speed docs insights OptimizeCSSDelivery example https developers
  • 线程和 fork()。我该如何处理呢? [复制]

    这个问题在这里已经有答案了 可能的重复 多线程程序中的fork https stackoverflow com questions 1235516 fork in multi threaded program 如果我有一个使用 fork 的
  • HTML标题属性样式[重复]

    这个问题在这里已经有答案了 如何在不使用 javascript 或 CSS 的情况下更改以下标记中标题属性的样式 因为我将 HTML 插入到原本无法编辑的文档中的特定位置 span title This is information Thi

随机推荐