zaagan
2/8/2018 - 3:51 PM

Linux commands Basic-Advance

Linux commands 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