郝 玉华

郝 玉华

1653003720

Linux 指令教學 - ls

熱愛 Python 以及 Linux, 希望透過寫程式為社會貢獻,喜歡拍程式教學影片幫助想學習的人。

這裡敘述了 Linux 系統中 ls 指令的各種用法,並蒐集了各式各樣的常用範例。ls 是 Linux 系統上最常被使用的指令之一,通常我們開啟終端機之後,第一個會執行的指令就是 ls。我們可能幾乎天天都在使用它,但是有些參數可能還是不熟悉如何使用,以下我們介紹各種 ls 指令的用法,並且提供一些常用範例作為參考。
 

列出檔案

ls -l

-l 顯示詳細的資訊 ( 檔案權限 )。

也等於直接輸入 (L 的小寫)

ll

在 Linux 中,檔案都擁有四種權限

可讀取 ( r,Readable ),用數字 4 表示。

可寫入 ( w,writable ),用數字 2 表示。

可執行 ( x,eXecute ),用數字 1 表示。

無權限 ( - ),用數字 0 表示。

為了更清楚,我把它整理成表格😋

字元權限分數
r (read)4
w (write)2
x (execute)1
- 無權限0

如下圖所示,

alt tag

接著說明裡面每一欄的意思,

alt tag

  • 第一欄 ( 圖上編號 1 ),使用者權限。

由 10 個字元組成,

第一個字元代表檔案型態 (- 為檔案,d 為目錄,l 為連結檔案 )。

第二、三、四個字元 表示檔案擁有者的存取權限。

第五、六、七個字元 表示檔案擁有者所屬群組成員的存取權限。

第八、九、十個字元 表示其他使用者的存取權限。

來看一個例子,drwxr-xr-x,

代表它是一個目錄,

擁有者具備讀、寫、執行權限,

所屬群組只擁有讀、執行權限,

其他使用者只擁有讀、執行權限。

為了更清楚,我把它整理成表格😋

 擁有者所屬群組其他使用者
drwxr-xr-x
代表是一個目錄具備讀、寫、執行權限只擁有讀、執行權限只擁有讀、執行權限

它的權限分數是 755

身份權限分數
ownerrwx4+2+1 =7
groupr-x4+0+1 =5
othersr-x4+0+1 =5

第二欄 ( 圖上編號 2 ),檔案數量。

第三欄 ( 圖上編號 3 ),擁有者。

第四欄 ( 圖上編號 4 ),群組。

第五欄 ( 圖上編號 5 ),檔案大小。

第六欄 ( 圖上編號 6 ),檔案建立時間。

第七欄 ( 圖上編號 7 ),檔案名稱。

ls 使用時間排序

ls -t

列出特定檔案 ( 列出為 .py 的檔案 )

ls *.py

-h 參數,使用 KB、MB、GB 單位顯示檔案或目錄大小。

ls -l -h

顯示全部的檔案 (包含隱藏檔)

ls -a

也可以使用

ls -al

可以直接列出資料夾內的內容

ls Downloads

像是在 home 底下, 直接列出 Downloads 內容

alt tag

sort

ls -S

將輸出結果 stdout 寫到文件裡, 可使用 redirect > (螢幕上不會顯示)

ls -lS > file.txt

計算路徑底下有多少個檔案

ls | wc -l

本影片 GitHub repo ▶ https://github.com/twtrubiks/linux-note

 #linux 

What is GEEK

Buddha Community

Linux 指令教學 - ls

Hire Dedicated Linux Developer

Looking to develop real-time applications?

Hire Dedicated Linux Developer from HourlyDeveloper.io, we have dedicated developers who have vast experience in developing applications for Linux and UNIX operating systems and have in-depth knowledge of their processes, kernel tools, internal architectures, and development packages.

Consult with experts:- https://bit.ly/2ZQ5ySP

#hire linux dedicated developer #linux developer #linux development company #linux development services #linux development #linux developer

How I Switched from Windows 10 to Linux Mint

This article is all about my journey on switching from Windows 10 to Linux Mint 20, how I got easily adapted to the Linux environment, and some resources that helped me to set up a perfect Desktop environment.

Uncertainty

Ok, now I have decided to switch to Linux but here comes the first question. Which distro will satisfy my needs both in terms of GUI and other aspects? Linux is not something new to me since I have been working with RHEL based distros in my work for the past 4 years with the command-line.

I know RHEL based distros are good for enterprises but not for personalized desktop environments, at least that’s what I am thinking till now. So I started my research to find the distro that should be easy for me to use and at the same time should have good community support if in case I ran into some problem. Among many Linux distros, I drilled down my list to 4 flavors.

Related ArticleThe Best Linux Distributions for Beginners

Before deciding the Distro it is necessary you formulate the list of tools/programs or packages needed and check if the distro you choose provides all those features.

For me, I use Linux for two main purposes: one is for my professional development work, writing articles, and second for my personal use like Video editing and Movies. Most of the popular software are created to be compatible with Windows, macOS, and Linux like Sublime TextVSCodeVLC Media PlayerFirefox/Chromium browser. Other than these software, cloud-based services make our life easy Like Microsoft Office 365 or G Suite.

#linux distros #linux mint #linux distros #linux mint tips #linux

I am Developer

1620616862

How to Delete Directories and Files in Linux using Command Line

In this remove or delete directories and files linux tutorial guide, you will learn how to remove empty directory and non empty directory linux using command line. And as well as how to remove/file files linux using command line.

If you work with Linux then you will need the following:

  • how to remove empty directory in linux,
  • how to remove non empty directory,
  • how to remove directory without confirmation linux
  • how to remove files with and without confirmation in linux.

So, this tutorial guide will show you you how to use the rmunlink, and rmdir commands to remove or delete files and directories in Linux with and without confirmation.

https://www.tutsmake.com/how-to-remove-directories-and-files-using-linux-command-line/

#how to delete directory in linux #how to remove non empty directory in linux #remove all files in a directory linux #linux delete all files in current directory #linux delete all files in a directory recursively #delete all files in a directory linux

Package Management in Linux - Linux Tutorial - Linux Training

Package Management in Linux - Linux Tutorial - Linux Training

#linux #linux tutorial #linux training

Tyshawn  Braun

Tyshawn Braun

1599742800

10 Best Ubuntu-based Linux Distributions

Ubuntu is arguably one of the most popular and widely-used Linux distribution owing to its classic UI, stability, user-friendliness, and a rich repository that contains over 50,000 software packages. Furthermore, it comes highly recommended for beginners who are trying to give a shot at Linux.

In addition, Ubuntu is supported by a vast community of dedicated opensource developers who actively maintain contribute to its development to deliver up-to-date software packages, updates, and bug-fixes.

There are numerous flavors based on Ubuntu, and a common misconception is that they are all the same. While they may be based on Ubuntu, each flavor ships with its own unique style and variations to make it stand out from the rest.

In this guide, we are going to explore some of the most popular Ubuntu-based Linux variants.

1. Linux Mint

Used by millions around the globe, Linux Mint is a massively popular Linux flavor based off of Ubuntu. It provides a sleek UI with out-of-the-box applications for everyday use such as LibreOffice suite, Firefox, Pidgin, Thunderbird, and multimedia apps such as VLC and Audacious media players.

Linux Mint Desktop

Linux Mint Desktop

Owing to its simplicity and ease-of-use, Mint is considered ideal for beginners who are making a transition from Windows to Linux and those who prefer to steer clear from the default GNOME desktop but still enjoy the stability and the same code base that Ubuntu provides.

The latest Mint release is Linux Mint 20 and is based on the Ubuntu 20.04 LTS.

#linux distros #ubuntu #linux distros #ubuntu linux distributions #linux