Linux 기본 사용법
12726 단어 자바
windows
__----------------
Desktop Os
Linux+VMware
-------------
Linux
Os
VMware
-----------------
Oracle vbox
------------------
Host
----------------
Linux | mac
——————————————————
Client
VMware
------------------
-------------
window:
——-----——————
c:/
d:/
e:/
linux
———————————————————
/bin //
/sbin //
/dev //device, , , ,
/etc //
/lib // , (so---shared object, dll )
/home // /home/ubuntu /home/ubuntu......
/meida
/mnt
/opt //root
/root
/usr //user
/usr/bin //
/usr/sbin //
/usr/local //
/usr/local/bin //
/usr/local/sbin //
Linux
--------------
1.redhat
2.centOs
3.ubuntu
4.Suse
5....
Unix
bin sbin
userbin
,
Linux
----------------
windows linux
cd cd //
pwd //
clear //
whoami //
sudo passwd //
ipconfig ifconfig // Ip
su root //
mkdir
rm
cp
mv
cat
touch
chow
ping www.baidu.com ping www.baidu.com //ping
tree find . | grep //ping
del rm -fR xxx // ( )
rmdir
echo touch hello.txt //
echo helloworld > hello.txt // ( )
echo helloworld >> hello.txt //( )
cat hello.txt //
type hello.txt //
C window linux
cat hello.txt //
copy a.txt ../b.txt cp hello.txt b/c/d //
cp hello.txt b/c/d/1.txt // 。
cp -R xxx ../
echo
nano Ctrl+0 ctrl+x
cat
deirect :>> > //
more
head -n hello.txt // N
tail -n hello.txt // N
which hostname //
sudo reboot //
uname -a // ,-all
file xxx.so //
s so lib , - ( )
lib so ,
tar //
tar -xvzf mytar.tar.gz // ( )
tar -tf mytar.tar //
tar -rf mytar.tar.xxx //-r
mount //
“”
umount /dev/cdrom
ls
gzip -l mytar.tar // ,
gzip -9 mytar.tar // ,
gzip -9 mytar.tar // ,
gzip -d mytar.tar.gz // ,
gunzip mytar.tar.gz // == gzip -d xxx.gz
sudo shutdown -p now // -p: -r:reboot
sudo halp -p
sudo mount //
sudo umount //
ln -s /exist_file link_name
jobs
kill %n
ps -Af
cut -c num1-num2
cmd --help
man cmd
help
info cmd
fdisk
fdisk -l //
fdisk /dev/sda //
...
df disk free
df -ah
dd diskdump
dd
dirname //
basename ( )
echo $(hostname)
echo $($cat 1.txt) //1.txt hostname, ,
cd —p mylink // ,
war //web
ear //enterprise
jar //java archive file
tar //
tar -f -
-c //
-f //
-v // verbose
-x //extract ,
-z // gzip
-----------------------
ls
-h
-a (.xxx)
-l:
--------------------
find
-------------------
find /usr/local
find .|xargs grep -ri "IBM" // ibm
find .|xargs grep -ri "IBM" -l //
find /cmd ".sh" -prin | ... // sh
ls | grep pig |cp 'xargs' ~/Download
xargs //
find . | grep txt | c[ 'xargs' //''
/etc
ls | grep host
ll
source hostname
nano
----------------------------------
1.nano hello.txt
2.ctrl + o //
3.ctrl + x //
4.ctrl + k //
5 ctrl + U //
Linux
-----------
1. (hard link)
, 2 , , 。
2. (symbolic link)
,
, ( , )
3.
ln hello.txt. hello.txt.ln //
4.grep
ls -al | grep "\->" //
jobs
-------------------
----------------
ps //process show
ps -Af //-A: -f
job
----------------
kill %1
cut
----------------------------
cat -c num1-num2
cut -c 1- // 1
cut -c -5 // 5
cut -c 3-5 // 3-5
——————————+
echo $path
echo ${PATH}
echo "PATH"
,
export mypath = /home/ubuntu // ,
export mypath =${path:-} // ,
export yourpath = // path
exprot $yourpath
exprot $yourpath=${PATH:-$PATH:-$mypath}
export $yourpath=${PATH:-$PATH1:-$mypath} // ,
path ,windows “;” ,linux “:”
export mypath=${path}:/home/ubuntu
echo $mypath
$env other //
${env} //{}
“$env” //""
export env = ${env:-$env:-$envn2} // env, env2
echo 'pwd' //
if["$1"="--conf"] //
if[$#-lt 1]
if[$#-gt 1]
if[-e xxx] //
if[-d] //wrong ,
if[-d xxx] //right
linux
---------------------
help export
if commands ,then commands ;
[else if commands ;then commands ;] ....[else commands;] fi
help if
hellp export
help while
help for
if
["$1" = "--conf"] //
---------------------------------
linux
1.$?
,0: !0=
2.$#
rm -r bin //$# = 2
3.$n
$0 //
$1 // ,rm -r bin $1=-r
..
4$@
rm -r bin //$@=-r bin
5.shift
$? //
$# //
$1 //
$O //
$@ //
shift //
${a/b/c} //
-----------------
1.a && b
a , b
2.a || b
a , b
3.a ; b
a , b,
4.(a ; b )
// , ,
ls -al ; cd /usr/ ; pwd
(ls -al;cd ~; pwd)
NetCat
--------------------
1.
2.TCP/IP
transfer control protocal ,internet protocal
Socket
ServerSocket //server,listener,port
Socket //connection,port
3. nc
nc -l 8888 // ServerSocket ,
&
nc localhost 8888 // , 8888
4. nc
nc -l 1234 > readme.txt // ,
nc localhost 1234 < readme.txt // ,
nc ip -z port-portn // ip
nc -v -w 2 s1-z 2000 - 4000
-v
-w
-z
--------------------
1.
nc -l 888 & //
2. , (job)
ctrl + z
joba // , jobid
3. job ,
bg %1
4.
fg %1
d:directory
-:file
b:block
l:link
r:read
w:write
x:execute
owner //
group //
other //
d rwx r-x r-x .... hello.txt
-----------------
1.read
:
2.write
:
3.
:
linux
------------------
help export
help if
help while
help for
if
["$1"="--conf"] //
Ubuntu
-----------------
if[$#-lt 1]
if[$#-gt 1]
if[-e xxx]
if[-d] //wrong
if[-d xxx] //right
$? // , ,0: !0:
$# // rm -r bin //$# = 2
$n // 。 $0 //
$1 // ,rm -r bin $1=-r
$0
rm -r bin //$@=-r bin
$1 //
$O //
$@ //
shift //
,
${a/b/c} //
$env other //
${env} //{}
"$env" //""
export env=${env:-$evn2} //
echo '${env}' //
echo 'pwd' //
if["$1"="--conf"] //
-------------------
1.
d:
-:
b:block
l:link
2.
Owner(user) //
group // ,linux , , primary group , secondary group
other //
all //owner+group+other
3.
r:read //rwx
111=7
w:write
x:exeute
————————————
chmod ugo+-=rwx hello.txt //
chmod a+rwx hello.txt //
chomd 777 hello.txt //
chomd 755 hello.txt //
---------------
1.useradd
, adduser
2.adduser
adduser
adduser --home /home/ubuntu2 ubuntu2 --gid 1000 ubuntu2 //ubuntu 1000
3.Ubuntu Ip
(1)
VMware ————> --> --> --> vmnet8 -->
nat --> (192.168.238.2)
(2) ip
VMware ————> --> --> --> vmnet8 -->
DHCP -->
Ubuntu
-----------
Ubuntu
apt:advanced package tookit ,
sudo apt-get install xxx //
sudo apt-cache search xxx //
sudo apt-get remove xxx //
sudo apt-get purge xxx //
sudo apt-get update //
sudo apt-get upgrade //
sudo dpkg -l | grep xxx //
163
deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted
ctrl+o-- -- ctrl+x--
sudo apt-get update
sudo apt-get upgrade
--------------
1. iso
2. iso /mnt/
mount /dev/cdrom /mnt/cdrom
3. /etc/apt/sources.list
[/etc/apt/sources.list]
deb file:/mnt/cdrom ./
4.
apt-get update
apt-get upgrade
5
sudo apt-cache search ubuntu-desktop
6.
sudo apt-cache-install ubuntu-desktop
7.
sudo apt-get remove ubuntu-desktop
Ubuntu VM
——————————————————
host
1.VMWare--> VMware tool
2。
3。 vmware-tool-xxxx.tar.gz
4。 vmware-tool-xxxx.tar.gz
5。
6。 ~/Desktop/vmware-tool-distrib
7。 python
sudo ./vmware-tool.pl
8。
9。Enjoy...
:
VMwareTools-9.9.3-2759765.tar.gz
---------------
1. 、
2.
--> --> --> (1366x768)
3 ok
4.
window linux
-----------------
1.
--> --> -->
2, /mnt/hgfs
--------------------
1.
--> --> -->
2.
dpkg
-----------
dpkg-query --help
dpkg-query --list | grep gedit
sudo dpkg --remove gedit
1. .deb
dpkg -i gedit_4-xx.deb
2. which
which gedit
3.
sudo dpkg --remove gedit
dpkg-query
---------------
1.
sudo dpkg-query --list | grep gedit
2. which
which gedit
3.
sudo dpkg --remove gedit
----------------
-----------
sudo apt-get install dpkg-dev
mkdir ~/software
cp -R -v /var/cache/apt/archives/* ~/software
sudo dpkg-scanpackages ~/software /dev/null
|gzip>~/software/Packages.gz
software host
ubuntu
host software
/etc/apt/source.list
deb file:/home/ubuntu/software./
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install xxx //
:
,
sources.list
Ubuntu ISO
————————————————
1. mkisofs
sudo apt-get install mkisofs
2. mkisofs iso
//-r -o
sudo mkisofs -r -o xxx.so /targ
Ubuntu iso
——————————————————————
1. iso
a. -> -> iso
b.
2. CDROM /mnt
sudo mkdir /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
Ubuntu Mac
Ubuntu
-------------
1.
, IP, ,
, ,
2.NAT
Host , Host NAT DNS, ,
, ,Host
。
net address transform
3.Only-host
NAT, , 。
IP
--------------
1. NAT
-->NAT-->NAT --> (192.168.119.2)
2.
-->NAT-->NAT --> (192.168.119.128)-->(192.168.119.254)
3. ip
192.168.119.130
4. ubuntu
/etc/network/interface
5.
sudo /etc/init.d/networking restart
6. ping
-----——————————————————————————————————
0.
help for
1.
for NAME [in WORDS ... ]; do COMMANDS; done
[ ]
for a in 1 2 3 4 ; do each $a ; done
while
for a in 1 2 3 4 ; do rm ${a}.txt ; done
ls
2.
[ ]for ((exp1;exp2;exp3)); do COMMANDS;done
[ ]for ((a = 1 ;a <= 11))
,
,
for 10
————————————————————————
a = 10
for
1.
while
---------------
1.
((EXP1))
while((EXP2));do
COMMANDS
((EXP3))
done
1.
2.
1-->10 10
---------------
#!/bin/bash
(( a=1 ))
while (( a <= 10 )) ; do
echo $a
((a = a + 1 ))
done
fro
---------------------
#!/bin/bash
((count = $# ))
((a=1))
while ((a<=count)) ; do
echo $1 ;
shift;
((a=a+1))
done
if
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Is Eclipse IDE dying?In 2014 the Eclipse IDE is the leading development environment for Java with a market share of approximately 65%. but ac...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.