Linux共通コマンドおよびディスクパーティション
7196 ワード
Linux共通コマンド
:cd .. - / ~
に入る...:前のレベルのディレクトリに戻る-:前回の操作を返すディレクトリ~:ホームディレクトリに戻る/:ルートディレクトリ :pwd
$>pwd 3を印刷する.touch作成ファイル基本構文:touchファイル名$>touch test :tac >( ) >>( )
$>tac test
:ls -al
$>ls -al
:mkdir [-p]
$>mkdir -p use/zhangyuejiu #
$>mkdir users #
:rmdir
$>rmdir users
$>rm use
rmdir: failed to remove `use': Directory not empty
:1. cp
2. cp -r
$>cp /home/hadoop/test /home/hadoop/use
$>cp -r /home/hadoop/use /home/hadoop/soft
:1.rm
2.rm -rf
$>rm ~/test~
$>rm -rf ~/use
:1.mv
2.mv
3.mv
$>mv ~/test1 ~/soft
$>mv test test.java
$>mv ~/soft/use ~
: more
$>sudo more /etc/sudoers
:enter :
:
b :
:less
$>sudo less /etc/sudoers
:enter :
:
b :
[pagedown]:
[pageup]:
:head -n
$>head -n 2 ~/test.java
:1.tail -n
2.tail -f #
$>tail -n 2 ~/test.java
$>tail -f test.java
$>echo 'hello' >>~/test.java
: ln -s
$>ln -s jdk1.8.0_151/ jdk
$>ls -l
lrwxrwxrwx. 1 hadoop hadoop 13 Jul 24 06:46 jdk -> jdk1.8.0_151/
$>cd jdk
$>pwd
/home/hadoop/soft/jdk
$>cd -P jdk
$>pwd
/home/hadoop/soft/jdk 1を作成する.8.0_151/説明:ソフトリンクは一般的にソフトウェアバージョンの切り替えに使用されます. :history
$>history
:1.echo ' ' >/>>
2.
$>echo 'hello' >>~/test.java
$>echo $PATH
:1.>
2.>>
$>ls -l >> ~/test.java
:1.date -s datestr #
2.date -d datedtr # datestr
$>sudo date -s '20190724 14:25:00'
$>date '+%Y%m%d'
クライアントリモート接続ツールMobaXterm
1. 【session】--> 【remote host】 linuxIP
ディスク管理コマンド(rootユーザー)
:fdisk -l
$>fdisk -l Disk/dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal): 512 bytes/512 bytes Disk identifier: 0x0005e7ea
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2358 18631680 83 Linux
/dev/sda3 2358 2611 2031616 82 Linux swap / Solaris
:Liunx
a.システムディスクパーティションの確認$>dfisk-l Disk/dev/sda:21.5 GB,21474836480 bytes 255 heads,63 sectors/track,2610 cylinders Units=cylinders of 16065*512=8225280 bytes Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x 005 e 7 ea Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2358 18631680 83 Linux
/dev/sda3 2358 2611 2031616 82 Linux swap / Solaris
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
: :/dev/sda(20G) /dev/sdb(2G) 。
b. /dev/sdb
$>fdisk/dev/sdbヒントに従ってそれぞれ入力:np 1 w c.パーティション化に成功したかどうかを検証する$>fdisk-l Disk/dev/sda:21.5 GB、2147475 GB、21474721475 GB 4836480 bytes 255 heads,63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal): 512 bytes/512 bytes Disk identifier: 0x0005e7ea Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2358 18631680 83 Linux
/dev/sda3 2358 2611 2031616 82 Linux swap / Solaris
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe6c435d9
Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux
:/dev/sdb , /dev/sdb1。
d.
$>mkfs.ext4/dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 131072 inodes, 524112 blocks 26205 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=536870912 16 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
e.
$>mkdir/bigdata $>mount/dev/sdb1/bigdata $>df Filesystem 1K-blocks Used Available Use% Mounted on/dev/sda2 18208184 2902184 14374416 17%/tmpfs 502068 228 501840 1%/dev/shm/dev/sda1 289293 34647 239286 13%/boot .host:/976727036 423336684 553390352 44%/mnt/hgfs/dev/sdb1 2030736 3072 1922844 1%/bigdata