您的位置:首页 > 其它

Ubuntu使用小技巧

2018-06-23 22:26 399 查看

1. Ubuntu下自由截图

Ubuntu下使用PrintScreen按键可以截取整个屏幕,但是很多时候并不需要那么多内容,还需要对图片进行编辑。

这时候就需要截图时,有矩形选择,更符合要求。

进入System Settings...->Keyboard->Shortcuts,然后选择Custom Shortcuts即可创建自定义的快捷键。

点击“+”,然后在弹出的窗口输入Name和Command如下,最后点击Disabled同时按下想要的快捷键,比如Shift+Ctrl+A。



结果变成如下。只要按下组合快捷键,那么鼠标就会变成十字形,即可选择自己想要的截图区域。



其实原因也很简单,gnome-screenshot -h即可知道。


Usage:
gnome-screenshot [OPTION...]

Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gapplication Show GApplication options
--help-gtk Show GTK+ Options

Application Options:
-c, --clipboard Send the grab directly to the clipboard-----------------------------------直接保存到剪切板,避免弹出框选择。
-w, --window Grab a window instead of the entire screen
-a, --area Grab an area of the screen instead of the entire screen---------------保存选择区域。
...



2. Windows通过SAMBA访问Ubuntu文件服务

这里的SAMBA可不是桑巴的意思,详细介绍参照这里SAMBA(Software)

好了直接介绍如何使用,如果没有安装过SAMBA服务,通过sudo apt-get install samba安装。

然后配置/etc/samba/smb.conf如下:


##############################
[jenkins]
comment = Share folder for jenkins
path = /home/jenkins----------------------------------------------Ubuntu系统的目录。
public = yes
writable = yes
#valid users = jenkins
create mask = 0700
directory mask = 0700
force user = jenkins
force group = jenkins
available = yes
browseable = yes


再修改了smb.conf之后需要重启smb服务。


/etc/init.d/smbd restart----------------重启smb服务

/etc/init.d/smbd start-------------------启动smb服务

/etc/init.d/smbd stop-------------------停止smb服务


3. 扫描局域网段的机器

安装nmap(sudo apt install nmap),然后执行扫描192.168.1.0~192.168.1.255网段所有可以ping通的机器。


nmap -sP 192.168.1.0/24



4. 遍历各进程获取详细信息

如果需要获取系统所有进程的详细信息,ps、top之类的可能满足不了要求。

可以通过遍历系统所有进程的/proc/xxx/stat,然后在Excel中进行查看。

如下脚本,遍历进程1~2000。

#!/bin/bash

for i in $(seq 1 2000)
do
if [ -f "/proc/$i/stat" ];then
cat /proc/$i/stat;
fi
done


将上面遍历结果,在Excel中打开,分隔符选空格即可。隐藏部分列之后,如下,可以看到很多详细的信息。



5. 清华大学 Kernel Mirror

如需克隆 linux 代码,使用



若要将 tuna mirror 加入已有代码库,可在已有仓库中运行。



或运行



将默认上游设置为 TUNA 镜像。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: