Helpful Basic Linux Commands for Developers
Java Processes
- jps: Shows all Java processes running on the machine.
- ps -eLf: Displays all running threads.
- ps -ef / -efH: Lists processes for runtime execution.
- ps -ef | grep java: Checks all Java processes.
- ps -a: Checks if Asterisk is running.
Scheduler and Sessions
- crontab -e: Edits the scheduler in Linux.
- screen -ls, screen -r, screen -S vas: Manages Putty sessions.
- lokkit: Opens firewall settings.
Download Barcode scanner for small shops |
Asterisk & Dahdi Commands
basterisk -vvc
dahdi_tools
#dahdi_cfg -vv # Reset channels
#asterisk -vvc # Start Asterisk
#asterisk -r # Reconnect to Asterisk
#asterisk -rx "dahdi show status" # Remote execution of Asterisk CLI commands
cli> ss7 show linkset 1
cli> dahdi show channels
cli> core show channels
cli> ss7 set debug on linkset 1
cli> ss7 block linkset 1
cli> ss7 unblock linkset 1
cli> ss7 block cic 1 15 # Example command
Linux Commands for Oracle & MySQL
Oracle
bashcd /home/<
UserName
>/oracle/product/10.2.0/db_1/bin/ # Path for Oracle in Linux
cmd/> dbca # Open Oracle Database Creation
su <
UserName
> sqlplus username/password@connect_identifier
sql> create user identified by password;
sql> grant dba to user;
sql> grant all privileges to user;
MySQL
bashmysql> repair table table_name; # Repair corrupted tables
mysql> GRANT ALL ON .* TO root@'ip' IDENTIFIED BY ''; # Allow connections from other IP
mysql> source path/filename.txt # Execute queries from a file
mysql> UPDATE mysql.user SET Password=PASSWORD('nbuser') WHERE User = 'root';
mysql> FLUSH PRIVILEGES;
mysql> optimize table tblName; # Defrag table
Linux System Management
System Configuration
- setup: Configures IP and gateway in Linux.
- route: Checks IP and gateway.
- traceroute IP: Traces route from source to destination IP.
- service --status-all: Checks the status of all running processes.
- chkconfig servicename on: Sets a service to start automatically on system restart.
- yum install php-mysql php-apache: Installs and configures PHP with MySQL and Apache.
- /sbin/chkconfig --list | grep mysqld: Checks autorun services at bootup.
- chkconfig --add tomcat: Autostart Tomcat at
/etc/init.d/tomcat
. - chkconfig --level 345 tomcat on: Sets run levels for Tomcat.
Firewall and Networking
bashservice iptables status
chkconfig iptables on
service iptables start
service iptables stop
service iptables restart
iptables -A INPUT -s -j DROP # Block incoming traffic from an IP
iptables -A OUTPUT -s -j DROP # Block output connection to an IP
iptables -A OUTPUT -p icmp --icmp-type 8 -j DROP # Disable ping
Miscellaneous Commands
nmap -sS -O 127.0.0.1 # Check all opened ports
dmidecode -t system # Display system information
wget completeURL # Download from a link
File and Directory Management
bashchown -R username /path # Provide permission to a user for the specified path
chown root:root /tmp; chmod 1777 /tmp # Resolve issues with writing to a directory
/etc/init.d/mysqld start # Start MySQL service
File Operations
bashcat *.txt > xyz.txt # Concatenate contents of multiple text files into a single file
rm filename.extension # Remove a file using Putty
mv folder destination # Move or rename a folder
scp -r /usr/test/ root@:/usr/test # Transfer data to a remote server
Text Editing and Manipulation
bashsed -i 's/old-word/new-word/g' *.txt # Replace a word in a text file
System Monitoring
bashtop -u username # Check CPU usage in Linux
df -H # Check hard disk space
dmesg | grep ^Memory: or free -m or free # Check RAM space
sudo dmidecode --type 17 # Display system information
VNC Server
bashrpm -qa | grep vnc
rpm -q vnc-server # Check if VNC package is available
service --status-all | grep vnc # Check VNC server status
rpm -Uvh vnc-4_1_3-x86_linux.rpm # Upgrade VNC server
rpm -ivh vnc-4_1_3-x86_linux.rpm # Install VNC server
rpm -e vnc-4_1_3-x86_linux.rpm # Uninstall VNC server
chkconfig --level 35 vncserver on # Set VNC server to start on run levels 3 and 5
yum groupinstall "GNOME Desktop Environment" # Install GNOME desktop environment for VNC server
System Information and Versions
bashcat /etc/redhat-release # Check Linux version
lsb_release -a # Check Linux version
mysql> SHOW VARIABLES LIKE "%version%"; # Check MySQL version
localhost# asterisk -V # Check Asterisk version
java -version or javac -version # Check Java version
SQL> SELECT * FROM v$version WHERE banner LIKE 'Oracle%'; # Check Oracle version
mysql> SHOW VARIABLES LIKE 'version'; # Check MySQL version
localhost# httpd -v # Check Apache version in Linux
Miscellaneous Commands
bashupdatedb # Update locate command database
sjphone SIP: shortCode@SystemIP # Make a call using SJ Phone SIP
sip:IP # Call Asterisk using SIP
Tomcat Installation
bashcd jakarta-tomcat-5.0.28
tar -zxvf tomcat.tar
cd bin
tar xvfz jsvc.tar.gz
cd jsvc-src
chmod +x configure
./configure
make
cp jsvc ..
cd ..
File Compression and Decompression
bashgzip filename # Zip a file in Linux
gunzip filename.z # Unzip a .Z type compressed file
unzip filename.zip # Unzip a .zip type compressed file
ens
Really help full for me....
ReplyDeleteThanks for sharing this Information. Java Training in Gurgaon
ReplyDelete