sh Linux命令Basic-Advance

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Linux命令Basic-Advance相关的知识,希望对你有一定的参考价值。

# https://www.computerhope.com/unix/uchmod.htm

chmod options permissions file name

#Example: 
chmod u=rwx,g=rx,o=r myfile

# u, g, and o stand for "user", "group", and "other".
# user can read, write, and execute it;
# members of your group can read and execute it;
# others may only read it.

chmod 754 myfile
#    7 is the combination of permissions 4+2+1 (read, write, and execute), 
#    5 is 4+0+1 (read, no write, and execute), and
#    4 is 4+0+0 (read, no write, and no execute).

#    4 stands for "read",
#    2 stands for "write",
#    1 stands for "execute", and
#    0 stands for "no permission."

#Viewing File permissions
ls -l file.txt

clear             Clear screen.
date              Print current date
nano example.txt  Opens the file example.txt in “Nano”, the Linux text editor.



 

#To be able to update the list of available software
sudo apt-get update

sudo apt-get install tree #Installing a package
#Inform the user how much disk space the package will take up
#And asks for confirmation of the package installation
#Entering Y (or just hitting Enter, as yes is the default action) will allow the installation to occur.
#This can be bypassed by adding the -y flag to the command:
sudo apt-get install tree -y

sudo apt-get remove tree #UnInstalling a package

#PURGE
sudo apt-get purge tree #Completely remove the package and its associated configuration files

sudo apt-get update #Update existing software

sudo apt-get upgrade #Upgrade all of your packages
sudo apt-get install somepackage #Upgrade a specific package

apt-cache search locomotive #Searching for softwares

apt-cache show sl #View Information about a package before installing

# Store or extract files from a tape archive file.
# Compress File:
tar -cvzf *filename.tar.gz* *directory/*
# Decompress File conents:
tar -xvzf *filename.tar.gz* 

# Compress in gzip format
gzip file1

# Decompress gzip file
gunzip file1.gz

以上是关于sh Linux命令Basic-Advance的主要内容,如果未能解决你的问题,请参考以下文章

Linux中的sh命令的详细解释

linux 做了个备份脚本 .sh的,用命令sh bf.sh可以执行,如何放到桌面上双击运行,并看到执行过程,非常感谢!

Linux下sh/bash/source/.命令的区别(转)

linux运行sh脚本出现/r

在linux中怎么使用sh执行当前目录的程序

linux sh -n 文件 运行后两个加号++ 啥意思?