熟悉常用的Linux操作

cd命令:切換目錄

(1)??? 切換到目錄 /usr/local

Cd /usr/local

(2)??? 去到目前的上層目錄

Cd ..

(3)回到自己的主文件夾

????? Cd ~

ls命令:查看文件與目錄

(4)查看目錄/usr下所有的文件

????? ls –al/usr

mkdir命令:新建新目錄

(5)進入/tmp目錄,創建一個名為a的目錄,并查看有多少目錄存在

mkdir a

ls -l

(6)創建目錄a1/a2/a3/a4

?? mkdir –p a1/a2/a3/a4

rmdir命令:刪除空的目錄

(7)將上例創建的目錄a(/tmp下面)刪除

rmdir a

(8)刪除目錄a1/a2/a3/a4,查看有多少目錄存在

????? rmdir –p a1/a2/a3/a4

????? ls -l

cp命令:復制文件或目錄

(9)將主文件夾下的.bashrc復制到/usr下,命名為bashrc1

(10)在/tmp下新建目錄test,再復制這個目錄內容到/usr

?Cd /tmp

Mkdir test

Sudo cp –r/tmp/test? /usr

mv命令:移動文件與目錄,或更名

(11)將上例文件bashrc1移動到目錄/usr/test

Sudo mv /usr/bashrc1 /usr/test

(12)將上例test目錄重命名為test2

?Sudo mv /usr/test /usr/test2

rm命令:移除文件或目錄

(13)將上例復制的bashrc1文件刪除

Sudo rm /usr/test2/bashrc1

(14)將上例的test2目錄刪除

?Sudo rm –r /usr/test2

cat命令:查看文件內容

(15)查看主文件夾下的.bashrc文件內容

?Cat ~ /.bashrc

tac命令:反向列示

(16)反向查看主文件夾下.bashrc文件內容

?Tac ~ /.bashrc

more命令:一頁一頁翻動查看

(17)翻頁查看主文件夾下.bashrc文件內容

?More ~/.bashrc

head命令:取出前面幾行

(18)查看主文件夾下.bashrc文件內容前20行

Head –n 20~/.bashrc

(19)查看主文件夾下.bashrc文件內容,后面50行不顯示,只顯示前面幾行

?Head –n -50/.bashrc

tail命令:取出后面幾行

(20)查看主文件夾下.bashrc文件內容最后20行

Tail –n 20/.bashrc

(21) 查看主文件夾下.bashrc文件內容,只列出50行以后的數據

?Taol –n +50~/.bashrc

touch命令:修改文件時間或創建新文件

(22)在/tmp下創建一個空文件hello并查看時間

Cd /tmp

Touch hello

Ls –l hello

(23)修改hello文件,將日期調整為5天前

?Touch –d? “5 days ago” hello

chown命令:修改文件所有者權限

(24)將hello文件所有者改為root帳號,并查看屬性

?Sudo chown root /tmp/hello

Ls –l/tmp/hello

find命令:文件查找

(25)找出主文件夾下文件名為.bashrc的文件

?Find~ -name .bashrc

tar命令:壓縮命令

(26)在/目錄下新建文件夾test,然后在/目錄下打包成test.tar.gz

Test.tar.gz

Sudo mkdir /test

Sudo tar –zcvf –f /test.tar.gz test

(27)解壓縮到/tmp目錄

?Sudo tar –zxvf –f /test.tar.gz –C /tmp

grep命令:查找字符串

(28)從~/.bashrc文件中查找字符串'examples'?

Grep –n ‘examples’ ~/.bashrc

(29)配置Java環境變量,在~/.bashrc中設置

Gedit ~/.bashrc

將語句 export JAVA_HOME=JDK 安裝路徑加入第一行并保存

Source ~/.bashrc

(30)查看JAVA_HOME變量的值

Echo $JAVA_HOME

轉載于:https://www.cnblogs.com/Runka/p/8558960.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/250813.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/250813.shtml
英文地址,請注明出處:http://en.pswp.cn/news/250813.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

2 Effect Hook

副作用:和外部有交互 引用外部變量調用外部函數修改dom、全局變量ajax計時器(依賴window.setTimeout)存儲相關 純函數:相同的輸入一定會得到相同的輸出 Effect Hook可以讓你在函數組件中執行副作用操作 類組件中處理副作用 在com…

【JUC】CountDownLatch

因為在調用端的異步中,需要調用其他多個服務獲取數據再匯總結果返回,所以用到了CountDownLatch CountDownLatch的概念 CountDownLatch是一個同步工具類,用來協調多個線程之間的同步,或者說起到線程之間的通信(而不是用…

node --- Missing write access to 解決

今天在使用npm安裝animate.css時報錯… 大體原因是沒有對node_modules沒有寫的權限. 百度查到是要刪除對應的node_modules然后在安裝… 但是我并不想這樣做…想起前面我為了加快下載速度,好像使用的是cnpm… 于是我使用了nrm ls 查看當前使用的源 更換npm的源可以參考 https:…

3 useReducer及其實現

pureComponent import { useState } from "react" // useReducer, // 統一調度 function reducer(state, action) {console.log(reducer接收參數, state, action)const { type } actionswitch (type) {case add:return { num: state.num 1 }case minus:return { n…

Django 之 權限系統(組件)

參考: http://www.cnblogs.com/yuanchenqi/articles/7609586.html 轉載于:https://www.cnblogs.com/bigtreei/p/8564243.html

vue踩坑- 報錯npm ERR! cb() never called!

在vue項目中引入餓了么elementUI組件的步驟之中&#xff0c;出現以下的錯誤&#xff1a; D:\my-project-first>npm i element-ui -S Unhandled rejection RangeError: Maximum call stack size exceededill install loadIdealTreeat RegExp.test (<anonymous>)at D:\n…

maven之阿里云Maven鏡像的使用

Maven中央倉庫在國外&#xff0c;速度比較慢&#xff0c;所以我們采用國內的鏡像&#xff0c;速度回有質的提升。 配置下setting.xml <mirrors><mirror><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/ne…

vue --- 使用animate.css實現動畫

1.下載animate.css npm install --save-dev animate.css// 注意你使用的源 nrm ls(若沒有改變可以忽略)2.導入animate.css <link rel"stylesheet" href"../node_modules/animate.css/animate.css"> // 注意你的當前文件和node_moudules文件夾的相對…

4 contextHook

類組件createContext、靜態屬性contextType 與函數組件useContext 的對比 import { Component, createContext, useContext } from react const AppContext createContext(0) class Foo extends Component {render() {return (<AppContext.Consumer>{value > (Foo: …

【leetcode 簡單】 第一百一十題 分發餅干

假設你是一位很棒的家長&#xff0c;想要給你的孩子們一些小餅干。但是&#xff0c;每個孩子最多只能給一塊餅干。對每個孩子 i &#xff0c;都有一個胃口值 gi &#xff0c;這是能讓孩子們滿足胃口的餅干的最小尺寸&#xff1b;并且每塊餅干 j &#xff0c;都有一個尺寸 sj 。…

基于openstack搭建百萬級并發負載均衡器的解決方案

最近&#xff0c;喜歡研究一些國外技術大咖們的文章&#xff0c;而這篇文章是基于openstack負載均衡器的解決方案&#xff0c;做的一些總結~希望能夠給小伙伴帶來一些靈感或者幫助。 openstack現有的負載均衡解決方案&#xff0c;無論是lbaas plugin還是octavia&#xff0c;后端…

5 useMemouseCallback

useMemo 優化渲染 現象 App每次重新執行時&#xff0c;render變化了&#xff0c;引用的render不是同一個函數 import React, { useState, } from "react"; const Foo props > {return <ul>{props.render()}</ul> } function App() {const [range…

vue --- 動畫執行的周期(動畫的鉤子函數)

如下8個: <transitionv-on:before-enter "beforeEnter"v-on:enter "enter"v-on:after-enter "afterEnter"v-on:enter-cancelled "enterCancelled"v-on:before-leave "beforeLeave"v-on:leave "leave"v-…

二分查找c++

相信對于二分查找的原理大家已經明白&#xff0c;接下來就是代碼實現了 1 #include <iostream>2 #include <cstdio>3 #include <algorithm>4 #include <cstring>5 #include <string>6 #include <cstdlib>7 8 using namespace std;9 10 in…

php獲取網址

1 #測試網址: http://localhost/blog/testurl.php?id52 3 //獲取域名或主機地址 4 echo $_SERVER[HTTP_HOST]."<br>"; #localhost5 6 //獲取網頁地址 7 echo $_SERVER[PHP_SELF]."<br>"; #/blog/testurl.php8 9 //獲取網址參數 10 echo …

6 useRef、useImperativeHandle

useRef在每次執行時返回的是同一個引用&#xff08;返回的ref對象在組件的整個生命周期內保持不變&#xff09;在函數組件中可以使用useRef和createRef但useRef性能比createRef好&#xff0c;快在類組件中&#xff0c;createRef是在初始化constructor時被賦值的&#xff08;執行…

vue --- 列表(v-for渲染)的各種神仙動畫效果

通過v-for生成的元素,使用transition包裹將只顯示第一條數據,此時需要使用transition-group包裹. <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-wid…

linux命令目錄

一、文件和目錄。&#xff08;文件目錄的增刪改查&#xff09; lspwdcdmkdirtouchrmdirlnddrmcpmvnlcattacmorelessheadtailstat###########################################grepawksed findlocatewhichwhereiswc ############################################dfdumountumoun…

vue --- 使用component的 :is屬性切換標簽頁

點擊對應的標簽,下面切換至對應的模板… // 說明 <component :is"name"></component> // 相當于把id為name的組件放到對應的位置總體代碼如下: <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"…

3-15 《元編程》第6章 3-16 hook method

Code That Writes Code 6.1 Coding your way to the weekend 6.2 Kernel#eval, Binding#eval Binding: Objects of class Binding(類Binding的對象) encapsulate &#xff08;密封&#xff09;the execution context at some particular place in the code and retain this c…