LINUX Commands
LINUX Commands
---------------
who am i ----> to know the user id.
free -h, -k, -m -----> to check the ram size of server (h > human readable, k >
kilobyte, m > megabyte).
cat /proc/cpuinfo ------> to find the cpu information of server / to find the
file content in mount i.e, /proc.
rm -rf -------> to delete the directory /file (it delete's the directory /file
empty or full).
cat >>filename -------> to create new empty (or) content file. {note: press
ctl+d after writing content in the file).
ls ------> to check list the files. (In metadata identifiers are : - file, d
directory, l links).
ls -l ,ls -la, ls -lr, ls -ls, ls -lsr, ls -lt, ls -ltr /tmp ---------> to open
list of files in specific location.
head filename -------> to see the content in the file at top side of file ( it
defaultly shows 10 lines of content).
head -number filename ------> to see the content in the file at top side of file
( it shows the no.of lines of content we given).
tail filename --------> to see the content in the file at bottom side of file ( it
defaultly shows 10 lines of content).
tail -number filename --------> to see the content in the file at bottom side of
file ( it shows no.of lines of content we given).
cat /etc/passwd ------------> to check the updated/to check the users list.
sudo chmod 111 filename -------> to change the permissions of file (permissions:
r-->read, w-->write, x-->execute)
values: 0 = no permissions
1 = execute only
2 = write only
4 = read only
3 = write & execute
5 = read & execute
6 = read & write
7 = all permissions
8 = no & invalid
sudo su ---------> to switch the user from another user ( it defaultly switch
to root user)
grep -i word filename -------> to search the content in the file with
excluding case-sensitive
grep -ic word filename -------> to search the content in the file with
how many occurencies are there.
package managements:
----------------------
sudo yum update -------> to check/update the packages in linux
nano filename --------> to edit the file in nano editor ( after editing
press ctl+x to save file)
GIT COMMANDS:
---------------
git init -------> to intialize the git in working area
git add <filename> ---------> to add the file from working area
to staging area (after this command git tracks the file).
git add -A ---------> to add the all files from working area to
staging area
maven commands:
---------------
mvn clean install -------> to clean the old build files and build
new artifact
ansible commands:
-----------------
syntax to ad-hoc commands:
---------------------------
ansible <clients> <module> <module arguments>
syntax to playbook:
-------------------
ansible-paybook <playbook name>
syntax to roles:
----------------
ansible-galaxy init <role name>
docker commands:
----------------
docker pull <image name> ----> to pull the images from docker-
hub
docker rmi <image name> ----> to delete the images from docker
kuberntes commands:
-------------------
objects in kubernets:
---------------------
namespace(ns), deployment(deploy), services(svc),
daemonset(ds), job, cronjob, statefullset, configmap, secrets, replication
controller, volume, user, role, rolebinding
operations in kubernetes:
-------------------------
create ----> create a resource from a file or from stdin