Linux Basics
Useful ls commands
ls -l -> lists all the details regarding files in the current directory
ls -a -> show hidden files as well. A file starting with . is considered hidden in linux.
ls -r -> reversing the order
ls -h -> size in human readable format
ls -t -> sort by time
ls -S -> sort by size
ls -X -> sort by extension
ls -R -> recursively show content of subdirectory
ls -1 -> listing file with one option. One per line.
ls | cowsay -> list in funny way
ls —color=never (double dash) to remove the colouring
Remember, every expert was once a beginner. With patience and practice, you'll soon be navigating the Linux file system like a pro!
pwd command: It has two addition options
pwd -L : logical means as per current structure
pwd -P: physical which means as per the actual structure
User:
User creation:
sudo useradd <user-name>
sudo useradd sitendra
Details about a user
cat /etc/passwd
sudo grep -w '<username>' /etc/passwd
unset keyword: It is used to remove the variable.
Example:
unset var1
For loop:
for item in $(seq 1 100);
do
echo "item #: $item"
done
Check the linux version details
cat /etc/os-release
Check the Linux platform architecture
uname -m
awk command is used to find lines in a file and perform actions on those lines.
Comments
Post a Comment