Partitions
# sudo -s ;login as root, and keep old enviroment variables.
# free -m |grep "Mem" | awk '{print $2}' ; you need to study awk
# fdisk -l
# df -th ;-t display fs type,
-h human-readable
# du -sh ;-s summary
分区挂载
# sudo mount -t 文件系统类型 设备路经 访问路经
常用文件类型:
iso9660 光驱文件系统,
vfat fat/fat32分区,
ntfs ntfs分区,
smbfs windows网络共享目录,
reiserfs、ext3、xfs Linux分区
如果中文名无法显示尝试在最後增加 -o nls=utf8 或 -o iocharset=utf8
如果需要挂载後,普通用户也可以使用,在 -o 的参数後面增加 ,umask=022 如:-o nls=utf8,umask=022
1. 只读挂载ntfs分区
# mount -t ntfs -o nls=utf8,umask=0 /dev/sdb1 /mnt/c
2. 可写挂载ntfs分区
# mount -t ntfs-3g -o locale=zh_CN.utf8,umask=0 /dev/sdb1 /mnt/c
3. 挂载fat32分区
# mount -t vfat -o iocharset=utf8,umask=0 /dev/sda1 /mnt/c
4. 挂载共享文件
# mount -t smbfs -o username=xxx,password=xxx,iocharset=utf8 //192.168.1.1/share /mnt/share
5. 挂载ISO文件
# mount -t iso9660 -o loop,utf8 xxx.iso /mnt/iso
6. 制作ISO文件
# mkisofs -o test.iso -Jrv -V test_disk /home/carla/
7. 转换目录到iso文件
mkisofs -o isofile.iso dirname
8. 转换CD到iso文件
dd if=/dev/cdrom of=isofile.iso
Processes
# watch ;execute command periodly
;-n or --interval: to specify a different interval. default = 2s
;-d or --differences:
; highlight the differences between successive updates.
;--cumulative option:
; makes highlighting "sticky", presenting a running display of all ; positions that have ever changed.
;-t or --no-title option :
; turns off the header showing the interval, command, and current time at the top of the display, as well as the following blank line.
# ps -?
ERROR: Garbage option.
********* simple selection ********* ********* selection by list *********
-A all processes -C by command name
-N negate selection -G by real group ID (supports names)
-a all w/ tty except session leaders -U by real user ID (supports names)
-d all except session leaders -g by session OR by effective group name
-e all processes -p by process ID
T all processes on this terminal -s processes in the sessions given
a all w/ tty, including other users -t by tty
g OBSOLETE -- DO NOT USE -u by effective user ID (supports names)
r only running processes U processes for specified users
x processes w/o controlling ttys t by tty
*********** output format ********** *********** long options ***********
-o,o user-defined -f full --Group --User --pid --cols --ppid
-j,j job control s signal --group --user --sid --rows --info
-O,O preloaded -o v virtual memory --cumulative --format --deselect
-l,l long u user-oriented --sort --tty --forest --version
-F extra full X registers --heading --no-heading --context
********* misc options *********
-V,V show version L list format codes f ASCII art forest
-m,m,-L,-T,H threads S children in sum -y change -l format
-M,Z security data c true command name -c scheduling class
-w,w wide output n numeric WCHAN,UID -H process hierarchy
# pstree
查看进程打开的文件
# lsof -p 进程的pid
显示开启文件abc.txt的进程
# lsof abc.txt
显示21端口现在运行什么程序
# lsof -i :21
显示nsd进程现在打开的文件
# lsof -c nsd
在后台运行程序,退出登录后,并不结束程序
# nohup 程序 &
# tail nohup ;查看中间运行情况
# top ;subcommand h or ?
Networking
根据IP查网卡地址
# arping IP地址 ;send ARP REQUEST to a neighbour host
根据IP查电脑名
# nmblookup -A IP地址
查看当前IP地址
# ifconfig eth0 |awk '/inet/ {split($2,x,":");print x[2]}'
# lsof -i :21 ;check the pid who are listening on port 21
同一个网卡增加第二个IP地址,
在网卡eth0上增加一个1.2.3.4的IP:
# ifconfig eth0:0 1.2.3.4 netmask 255.255.255.0
删除增加的IP:
# ifconfig eth0:0 down
立即让网络支持nat
# echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
# sudo iptables -t nat -I POSTROUTING -j MASQUERADE
查看路由信息
# netstat -rn
# sudo route -n
手工增加一条路由
# route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
手工删除一条路由
# route del -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
修改网卡MAC地址的方法
# ifconfig eth0 down #关闭网卡
# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE #然后改地址
# ifconfig eth0 up #然后启动网卡
对7.10的永久改地址方法
# gedit /etc/network/interfaces
在 iface eth0 inet static 后面添加一行:
pre-up ifconfig eth0 hw ether 01:01:01:01:01:01
配置文件应该像如下
face eth0 inet static
pre-up ifconfig eth0 hw ether 01:01:01:01:01:01
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
最后是 logout 或者reboot
统计当前IP连接的个数
# netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r -n
# netstat -na|grep SYN|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r -n
统计当前20000个IP包中大于100个IP包的IP地址
# tcpdump -tnn -c 20000 -i eth0 | awk -F "." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | awk ' $1 > 100 '
屏蔽IPV6
# echo "blacklist ipv6" | sudo tee /etc/modprobe.d/blacklist-ipv6
察看当前网络连接状况以及程序
# netstat -atnp
查看网络连接状态
# netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
查看当前系统所有的监听端口
# nc -zv localhost 1-65535 ;netcat
查看网络的当前流量
安装 ethstatus 软件
# apt-get install ethstatus
查看 ADSL 的速度
# ethstatus -i ppp0
查看 网卡 的速度
# sudo ethstatus -i eth0
查看域名的注册备案情况
# whois baidu.cn
查看到某一个域名的路由情况
# tracepath baidu.cn
重新从服务器获得IP地址
# dhclient
从当前页面开始镜像整个网站到本地
# wget -r -p -np -k http://www.21cn.com
· -r:在本机建立服务器端目录结构;
· -p: 下载显示HTML文件的所有图片;
· -np:只下载目标站点指定目录及其子目录的内容;
· -k: 转换非相对链接为相对链接。
如何多线程下载
# apt-get install axel
# axel -n 5 http://xxx.xxx.xxx.xxx/xxx.zip
或者
# lftp -c "pget -n 5 http://xxx.xxx.xxx.xxx/xxx.zip“
如何查看HTTP头
# w3m -dump_head http://www.xxx.com
Services
添加一个服务
# update-rc.d 服务名 defaults 99
删除一个服务
# update-rc.d 服务名 remove
临时重启一个服务
# /etc/init.d/服务名 restart
临时关闭一个服务
# /etc/init.d/服务名 stop
临时启动一个服务
# /etc/init.d/服务名 start
文件和文件夹
# locate filename ;same as find command
# touch filename ;create empty file
# cd ;same as cd ~
将当前目录下最近30天访问过的文件移动到上级back目录
# find . -type f -atime -30 -exec mv {} ../back \;
将当前目录下最近2小时到8小时之内的文件显示出来
# find . -mmin +120 -mmin -480 -exec more {} \;
删除当前目录里面所有的 .svn 目录
# find . -name .svn -type d -exec rm -fr {} \;
删除当前目录所有以“~”结尾的临时文件
# find . -name "*~" -exec rm {} \;
备份当前系统到另外一个硬盘
# rsync -Pa / /media/disk1 --exclude=/media/* --exclude=/home/* --exclude=/sys/*
--exclude=/tmp/* --exclude=/proc/* --exclude=/mnt/*
去掉文件中的^M, 注意不要使用同样的文件名,会清空掉原文件
# cat filename | tr -d "^M" > newfile;
或者
# sed -e "s/^M//g" filename > newfile;
Nautilus
显示隐藏文件 Ctrl+h
显示地址栏 Ctrl+l
特殊 URI 地址
* computer:/// - 全部挂载的设备和网络
* network:/// - 浏览可用的网络
* burn:/// - 一个刻录 CDs/DVDs 的数据虚拟目录
* smb:/// - 可用的 windows/samba 网络资源
* x-nautilus-desktop:/// - 桌面项目和图标
* file:/// - 本地文件
* trash:/// - 本地回收站目录
* ftp:// - FTP 文件夹
* ssh:// - SSH 文件夹
* fonts:/// - 字体文件夹,可将字体文件拖到此处以完成安装
* themes:/// - 系统主题文件夹
查看已安装字体
# fc-list
在nautilus的地址栏里输入”fonts:///“,就可以查看本机所有的fonts (这个似乎不行)
时钟
读取CMOS时间
# hwclock --hctosys
从服务器上同步时间
# ntpdate ntp.ubuntu.com
# ntpdate time.nist.gov
设置电脑的时区为上海
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
XP 和 Ubuntu 相差了 8 小时的时差
关闭UTC,将当前时间写入CMOS。
# sed -ie 's/UTC=yes/UTC=no/g' /etc/default/rcS
# hwclock --systohc
Others
延迟抓图
# gnome-screenshot -d 10 #延迟10秒抓图
# gnome-screenshot -w -d 5 #延迟5秒抓当前激活窗口
回收站在哪里
$HOME/.local/share/Trash/
默认打开方式的配置文件在哪里
全局 /etc/gnome/defaults.list
个人 ~/.local/share/applications/mimeapps.list
Firefox 的缓存目录在哪里
ls ~/.mozilla/firefox/*.default/Cache/
Pidgin 的聊天记录在哪里
~/.purple/logs/
分享到:
相关推荐
一.系统初始化 二.输入法 三.系统美化 四.影视工具 五.文件浏览 六.系统管理 七.其他软件 八.虚拟 九.编程环境 十.KDE 十一.Ubuntu 出现的一些问题 十二.Ubuntu 使用技巧
ubuntu命令大全和常用技巧,包括dpkg和vim配置技巧
原创,论述了ubuntu linux下Latex+cjk和xetex+cjk方案的优缺点,还有一些通用的小技巧。
Ubuntu资料大集合,包括新东方Linux培训教材,Ubuntu命令技巧手册,安装与配置手册,Linux从入门到精通一系列学习资料,是自己刚开始学Linux Ubuntu时收集的资料,免去你四处搜集的麻烦,欢迎下载。
以自己的亲身应用为基础,详细讨论了在ubuntu8.10系统上安装配置virtualbox的技巧,包括共享文件夹设置,U盘使用,桥接网络的配置等实用技术
现在我们常见的一些关于Linux的系统很多,但是使用的更多的一般都是CentOS和Ubuntu,今天我就来记录一下关于centos下java的安装和环境变量的配置。 首先使用xshell连接到centos7,我使用的是centos7 *64位,所以一切...
主要介绍了Ubuntu14.04服务器环境下配置PHP7.0+Apache2+Mysql5.7的方法,较为详细的分析了Ubuntu14.04操作系统环境下配置PHP7.0+Apache2+Mysql5.7的具体步骤与相关命令使用技巧,需要的朋友可以参考下
通过本文给大家分享ubuntu16.04服务器配置ssh免密码登录的方法,分为客户端和服务端操作及ssh简写技巧,非常不错具有一定的参考借鉴价值,感兴趣的朋友一起看看吧
安装,配置和设置 Ubuntu 14.04 LTS,Ubuntu 15.04 LTS,Ubuntu 16.04 LTS 发行iso ftp地址,在Macbook Pro 13上安装ubuntu 音乐软件跟踪器milkytracker,防病毒sophos,lampp xampp安装 备份linux,apache缓存,...
换句话说:在这里,我们分享有关Windows上的Ubuntu上的Bash的资源,技巧,已知问题等。1.如何在Windows 10(Linux的Windows子系统)的Ubuntu上安装Bash 安装Windows 10周年更新转到“打开或关闭Windows功能” 向下...
dotfiles:更快配置Linux PC的技巧
目前,我们仅通过此技巧支持CentOS和Ubuntu。 经验证的发行版: CentOS 7(x86_64,ppc64le) Ubuntu 16.04 Xenial(amd64,ppc64le) Ubuntu 18.04 Bionic(amd64,ppc64le) 只需将其添加到Dockerfile的末尾即可...
3)系统管理篇:服务状态的查询命令,服务配置文件的缩写,访问控制方式分类以及源代码编译安装等。4)硬盘分区:链接文件及挂载命令等;5)BASH方面:Shell脚本的如何使用,内部命令与外部命令;6)进程与内存的...
v4l2loopback_tricks v4l2loopback技巧 基于v4l2loopback内核模块的技巧/工具 ... Ubuntu / Debian安装: sudo apt install v4l2loopback-dkms 配置内核模块 echo options v4l2loopback devices=1 video_nr=20 \ ca
这个是我的vim配置,主要for python多一些,python的插件也较多。 相关技巧参考这个文档: 比如补全怎么用,跳转怎么用等等。 还有这篇参考资料,可以看看一些常用的快捷键,看看怎么跳转代码: vim技巧,推荐阅读:...
软件开发的断点调试是必不可少,这里介绍ubuntu10.04中eclipse工具中php的调试配置。
这是一本相当非常详细的书,分成了三章Basic Administration, Networking 和 Bunch O’Stuff, 共有将近1000页,30节。 12.HUBeginning Ubuntu LinuxUH,作者Keir Thomas 和 Jaime Sicam。对于那些想从Windows转向...
操作系统:在CentOS / RHEL 7和8 (推荐), Ubuntu 16和18和Raspbian上进行了测试 口译员: Python 2.7.5+ 安装 使用内置的安装程序,FreeZTP的安装快速简便。 单击右侧的图片,以观看有关FreeZTP的安装,初
我在Fedora Linux和带有Ubuntu的WSL之间来回穿梭。 我建议不要直接使用这些dotfile。 有些命令可能仅在我的设置或工作流程中专门起作用。 随意将相关位复制到自己的点文件中 设置 将仓库克隆到$ HOME / .config中 ...