Linux
Linux
Linux
Linux Page 1
a. Directory /
b. Executable file : *
c. Linked file : @
d. Ls -F /bin : example
27. ls -l /etc | head -20
28. ls -l -d */ -<
29. locate
Locate -n 5 *.conf -> it will display first 5 search results
Locate -I --limit 3 *.conf -> it will display in case sensitive and limit first 3 search results
locate -e *.json
locate --regex -i "(\.mp4|\.avi)"
Updatedb -> to update locate db
30 .vi
Command Insert Text
i before cursor
a after cursor
A at the end of the line
o open a line below the current line
O open a line above the current line
r replace the current character
R replace characters until <ESC>, overwrite
Cat /etc/passwd
Cat /etc/group
Cat /etc/hosts
$# number of arguments
$0 script name (./test.sh)
$1 first argument
$2 second argument
$* all arguments
$@ all arguments
$? Represents exit code of previously executed command or script
Scripts
#! /bin/bash
echo "The Number for arguments : $#"
echo "The Script Name : $0"
echo "The First argument " $1"
echo "All Arguments : $*"
echo "All Arguments with : $@"
Linux Page 2
$@ -> all commands line arguments with space separator
$* -> all commands line arguments with single string default is space
#! /bin/bash
len=$(echo -n "$1" |wc -c)
echo "The length of given string $1 : $len"
#!bin/bash
timestamp=$(date +%d_%B_%Y)
echo $timestamp
rm -r $timestamp
mkdir $timestamp
cp *.sh $timestamp/
Grep
==========
==========
uname
Uname -a display linux version
Uname -s
Uname -n node name
Uname -o operating system
Uname -r kernal name
Uname -v kernel version
Uname -m machine 64 or 32
Uname -p processor name
Uname -I hardware platform
Uptime
Uptime
Tmux
Linux Page 4
Tmux
Linux Page 5
Linux Page 6
Login Credentials
04 May 2023 20:52
Moksha
Apple@4321
192.168.1.7
Linux Page 7