Skip to main content

Posts

linux bash scripting cheatsheet

if statement

Recent posts

linux cheatsheet

Linux CheatsheetUsers management
History
Network
Permissions
Redirection
Network sniffer
systemd
text manipulation - awk and sed
System infoWhatHowname of hosthostnameFQDN of hosthostname -AIP address of hosthostname -imemory usagefree -hLinux flavorcat /etc/*-release
cat /proc/version
lsb_release -adisk usagedf -hfolders sizedu -ahtotal disk usage off the current directorydu -shHistory toolWhatHowRun last command starting with abc!abcPrint last command starting with abc!abc:pLast argument of previous command!$Search historyCONTROL-RAll arguments of last command!*First argument of last command!^Take second argument of last cp commandls -l !cp:2Network netstat man page
netstat examples

View Only Established Connectionnetstat -natu | grep 'ESTABLISHED'
-a = Show both listening and non-listening (for TCP this means established connections) sockets
-t = tcp
-u = tudp
-n = Show numerical addresses instead of trying to determine symbolic hostListing all the LISTENING Ports of TCP and UDP conn…

systemd

SystemD cheatsheet
systemd is a system and service manager for Linux, compatible with SysV
Overview of systemd for RHEL 7 Understanding and administering Systemd

WhatCommand service foobar start systemctl start foobar sservice foobar stop systemctl stop foobar service foobar status systemctl status foobar.service Listing dependencies: To see dependencies of a service systemctl list-dependencies nfs-server.service loaded services systemctl -t service installed services: systemctl list-unit-files -t service check for services in failed state systemctl --state failed



vi tips and shot cheatsheet

WhatHowmark place in amagoto aStart of line0End of line$Copy current lineyyCopy 5 lines5yyPastep
P - before lineCopy to a named bufferayy  - name is a'Paste name bufferappDelete till a character XdfX










Install4J ERROR: The installation/removal of a previoius program was not completed.

Error that may stop new installation:
The installation/removal of a previoius program was not completed. You will need to restart your computer to complete that installation. After restarting your computer, run Setup again to complete the installation of Program name.
How to solve the issue without restarting:
Remove following keys:
HKEY_CURRENT_USER\SOFTWARE\ej-technologies\install4j\RebootCheckFile
HKEY_LOCAL_MACHINE\SOFTWARE\ej-technologies\install4j\RebootCheckFile
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations 

elasticsearch installation cheatsheet

SystemD cheatsheet:
systemd is a system and service manager for Linux, compatible with SysV. Overview of systemd for RHEL 7 - https://access.redhat.com/articles/754933 Fedora Quick Docs | Fedora Quick Docs | Understanding and administering Systemd - https://docs.fedoraproject.org/quick-docs/en-US/understanding-and-administering-systemd.html

WhatCommandservice foobar startsystemctl start foobarsservice foobar stopsystemctl stop foobarservice foobar statussystemctl status foobar.serviceListing dependencies: To see dependencies of a servicesystemctl list-dependencies nfs-server.service

docker cheatsheet

Short docker commands list (in table view):

ImagesWhatHowList local imagesdocker imagesDelete local imagedocker rmi NAMEDownload imagedocker image pull NAMECreate container from image (detached) docker run –d …Display information on imagedocker image inspect hpsoftware/almoctane
ContainersWhatHowList of running docker containersdocker psList all docker containers (running and stopped)docker ps -aStart existing containerdocker start IDStop contianerdocker stop IDCreate container, start it and get a shell inside of itdocker run -it IMAGE bashRun a command inside of an already running containerdocker exec -it ID bashDelete containerdocker rm IDGet logdocker logs ID OtherWhatHowCreate virtual networkdocker create network octane_nwStart docker servicesystemctl start dockerDefine proxymkdir -p /etc/systemd/system/docker.service.d
vi /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="HTTP_PROXY=http://proxy.il.hpecorp.net:8080/“

sudo systemctl daemon-reload
sud…