linux小命令

本文主要记录了我在工作中用到的一些linux命令

 

1、查询linux系统是32位还是64位

zhaolei@zhaolei :~# file /usr/bin/whoami
/usr/bin/whoami: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

 

2、自动登入SSH

zhaolei@zhaolei:~$ ssh-keygen -t rsa
zhaolei@zhaolei:
~$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.100
zhaolei@zhaolei:~$ ssh root@192.168.1.100

 

3、修改用户登入名

zhaolei@zhaolei:~$ sudo usermod -l flyingzl zhaolei

下次登入后,zhaolei就无法登入了,改用flyingzl登入,登入后的命令行效果如下:

linux小命令
linux小命令
linux小命令代码
flyingzl@zhaolei:~$ finger flyingzl
Login: flyingzl Name: zhaolei
-linux
Directory:
/home/zhaolei-linux Shell: /bin/bash
On since Mon Nov
1516:21 (CST) on tty7 from :0
3 days 16 hours idle
On since Mon Nov
1516:21 (CST) on pts/0 from :0.0
No mail.
No Plan.
flyingzl@zhaolei:
~$
linux小命令
linux小命令

 

4、MySQL编码修改

修改/etc/mysql/my.cnf文件,在[mysql]和[mysqld]下增加default-character-set utf8

linux小命令

linux小命令

 

5、任务计划

root@one-desktop:~# crontab -e
root@one-desktop:~# crontab -l

crontab -e 命令表示编辑任务计划,crontab -l 表示显示已有的任务计划,看截图:

linux小命令

解释一下,m表示minute,可选值为0~59;h表示hour,可选值为0~23;dom即Day Of Month,可选值为1~31;month表示月份,可选值为1~12;down即Day Of Week,表示星期几,可选值为0~6,0表示周日;command表示要执行的命令。

根据上面的解释,0 9 * * 1-5 就表示每周一~周五的9点执行命令。

 

6、提示 NO_PUBKEY 6AF0E1940624A220

输入命令 sudo gpg --keyserver keyserver.ubuntu.com --recv 0624A220 ,然后再sudo apt-get update即可

 

linux小命令
linux小命令
linux小命令
oot@ubuntu:~# gpg --keyserver keyserver.ubuntu.com --recv 0624A220 
gpg: requesting key 0624A220 from hkp server keyserver.ubuntu.com
gpg: key 0624A220:
"Launchpad PPA for TualatriX" not changed
gpg: Total number processed:
1
gpg: unchanged:
1

root
@ubuntu:~# apt-key list
/etc/apt/trusted.gpg
--------------------
pub 1024D
/437D05B5 2004-09-12
uid Ubuntu Archive Automatic Signing Key <ftpmaster
@ubuntu.com>
sub 2048g
/791643872004-09-12

pub 1024D
/FBB75451 2004-12-30
uid Ubuntu CD Image Automatic Signing Key <cdimage
@ubuntu.com>

pub 1024R
/0624A220 2009-01-19
uid Launchpad PPA
for TualatriX

root
@ubuntu:~#
linux小命令
linux小命令

 

7、访问windows共享文件夹

 

linux小命令
linux小命令
linux小命令
flyingzl@zhaolei:~$ smbclient //10.4.68.14/www -U zhaolei%password
Domain
=[PLATFORM] OS=[Windows 7 Ultimate 7600] Server=[Windows 7 Ultimate 6.1]
smb: \
> dir
. D
0 Tue Mar 909:49:042010
.. D
0 Tue Mar 909:49:042010
phpinfo.php A
65 Wed May 2708:48:562009
phpMyAdmin D
0 Tue Mar 909:49:042010
ext
-3.1.1 D 0 Tue Feb 907:22:002010
two.html A
712 Thu May 2016:04:262010
dojo
-release-1.5.0rc1 D 0 Fri Jun 1114:26:142010
飞秋.exe A
3305472 Sat Feb 2011:57:522010
django
-docs D 0 Thu Jun 1717:14:302010
statusnet
-0.9.3 D 0 Wed Jun 3003:09:482010
demo.php A
32 Thu Oct 2814:41:382010
hyk
-proxy-install_0.9.0.exe A 2146018 Wed Oct 2020:36:282010
charts D
0 Wed Oct 2709:15:542010
demo1.php A
111 Thu Oct 2814:44:042010
HQ.SQL A
1947 Tue Nov 214:37:482010
ajaxplorer
-core-3.1.0 D 0 Mon Nov 1518:46:142010
FusionWidgets_Developer D
0 Mon Jul 1910:30:322010
java
-linux.bin A 83790617 Wed Nov 2418:23:082010

49558 blocks of size 524288. 19119 blocks available
smb: \
>

linux小命令
linux小命令

 

也可以直接用命令 smbclient -c "dir" //10.4.68.14/www -U zhaolei%password

 

8、同步服务器时间

 

linux小命令
suo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#设置utc为no
sudo vim /etc/default/rcS

sudo ntpdate cn.pool.ntp.org
linux小命令

 

9、通过apt-get安装sun-jdk

    在/etc/apt/sources.list中增加"deb http://archive.canonical.com/ lucid partner",然后apt-get update、apt-get install sun-java6-jdk即可

linux小命令,布布扣,bubuko.com

linux小命令

上一篇:从Linux的ext2文件系统源码学到一种初始化结构体的新方法


下一篇:Linux and the Unix Philosophy (Linux/Unix设计思想)