Unix is a multitasking, multi-user computer operating system.
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute or by creating text scripts of one or more such commands.
The most influential Unix shells have been the Bourne shell and the C shell. The Bourne shell, sh, was written by Stephen Bourne at AT&T as the original Unix command line interpreter; it introduced the basic features common to all the Unix shells, including piping, here documents, command substitution, variables, control structures for condition-testing and looping and filename wildcarding.
The C shell, csh, was written by Bill Joy while a graduate student at University of California, Berkeley. The language, including the control structures and the expression grammar, was modeled on C. The C shell also introduced a large number of features for interactive work, including the history and editing mechanisms, aliases, directory stacks, tilde notation, cdpath, job control and path hashing.
touch
|
Used to set same date & time for all files under folder
|
Ps –ef | grep java
|
Shows which java processes are running on the machine
|
Pgrep java | xargs pwdx
|
Shows which java processes are running on the machine and which directory they started from
|
Kill -9 <processId>
|
To kill the processes by id.
|
$ telnet x.x.x.x port
$ telnet eh-mbp-p-db05 1521
|
Attempt to connect to a service running on a IP address and port. Very useful for checking if the firewall is open between the server running the command and the end point. NOTE you must be sure that the end service is running.
The example shows proving that we can connect to a database listenner running on db05.
|
# netstat –an
# netstat –an |grep 2100
# netstat –an |egrep “210[0-9]”
netstat -a -n -o |
Must be logged in as root.
Check the port connections open by processes on this machine.
Check if any process has port 2100 open on this machine.
Check if any process has a port open in the range 2100-2109.
|
$ less <filename>
|
Very useful to view large log files on a unix system.
|
nohup.out
|
Used to append the console logs to file
|
chown user:usergroup filenme
|
used to change the user for file / folder
|
sudo su - newuser
|
to change the user
|
List all process for current user
Delete all files and folders in current location
Download file
Grant execute permission
Grant permission to a specific user
Copy complete directory including sub-dir
Unzip
Tail
Kill process
environment variables
List file sizes
Free space
Free memory
Process
Find
Reload .profile
Find pattern in files under
SCP file copy via ssh
Importing the security certificates on Unix machines -
- echo | openssl s_client -connect xxx.xxx.xxx.xxx:10000 -tls1 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > client.pem
- openssl x509 -outform der -in client.pem -out client.crt
- keytool -import -keystore cacerts -file client.crt -alias <serverIpaddress>
- Password - changeit