Sunday, March 6, 2022

Some useful Linux Commands...

01. ls – The most frequently used command in Linux to list directories
02. pwd – Print working directory command in Linux
03. cd – Linux command to navigate through directories
04. mkdir – Command used to create directories in Linux
05. mv – Move or rename files in Linux
06. cp – Similar usage as mv but for copying files in Linux
07. rm – Delete files or directories
07. touch – Create blank/empty files
07. ln – Create symbolic links (shortcuts) to other files
08. cat – Display file contents on the terminal
09. clear – Clear the terminal display
10. echo – Print any text that follows the command
11. less – Linux command to display paged outputs in the terminal
12. man – Access manual pages for all Linux commands
13. uname – Linux command to get basic information about the OS
14. whoami – Get the active username
15. tar – Command to extract and compress files in Linux
16. grep – Search for a string within an output
17. head – Return the specified number of lines from the top
18. tail – Return the specified number of lines from the bottom
19. diff – Find the difference between two files
20. cmp – Allows you to check if two files are identical
21. comm – Combines the functionality of diff and cmp
22. sort – Linux command to sort the content of a file while outputting
23. export – Export environment variables in Linux
24. zip – Zip files in Linux
25. unzip – Unzip files in Linux
25. ssh – Secure Shell command in Linux
26. service – Linux command to start and stop services
27. ps – Display active processes
28. kill and killall – Kill active processes by process ID or name
29. df – Display disk filesystem information
30. mount – Mount file systems in Linux
31. chmod – Command to change file permissions
32. chown – Command for granting ownership of files or folders
33. ifconfig – Display network interfaces and IP addresses
34. traceroute – Trace all the network hops to reach the destination
35. wget – Direct download files from the internet
36. ufw – Firewall command
37. iptables – Base firewall for all other firewall utilities to interface with
38. apt, pacman, yum, rpm – Package managers depending on the distro
39. sudo – Command to escalate privileges in Linux
40. cal – View a command-line calendar
41. alias – Create custom shortcuts for your regularly used commands
42. dd – Majorly used for creating bootable USB sticks
43. whereis – Locate the binary, source, and manual pages for a command
44. whatis – Find what a command is used for
45. top – View active processes live with their system usage
46. useradd and usermod – Add new user or change existing users data
47. passwd – Create or update passwords for existing users

Saturday, February 12, 2022

There are three levels of knowledge and according to the scope of knowledge, there are differences in human behavior...

There are three levels of knowledge and according to the scope of knowledge, there are differences in human behavior...

First level: When a person enters the first level of knowledge after acquiring some basic knowledges, he/she becomes arrogant and thinks that he/she knows or has learned everything.

Second level: When a person is able to understand something as soon as he/she knows it, it can be called the second level of knowledge. At this stage he/she becomes humble, and his/her curiosity grows for acquiring more knowledge.

Third level: When the complete knowledge comes on all matters and he/she enters the third or higher level of knowledge by easily acquiring the skill of understanding everything well, he/she easily realize his/her mistakes. Even after knowing a lot, he/she thinks or realize that he/she knows nothing.

We have to try to reach the higher level for acquiring knowledge.

-Collected

Wednesday, April 15, 2020

MySQL JDBC Driver - Time Zone Issue

MySQL JDBC Driver - timezone issue or the server timezone value 'unknown' is unrecognized or represents more than one value, etc. occurred then following step would help to resolve: 

Just add the following line end of JDBC connection string,
?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
Complete connection string below,
jdbc:mysql://hostname_or_ip:port/db_name?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

MySQL InnoDB ib_logfile0, ib_logfile1 & ibdata1 file size issue


Following steps would solve the issue:

Step-1: MySQLDump all databases into a SQL text file (e.g. SQLDataBackup.sql)

Step-2: Drop all databases (except mysql, information_schema and performance_schema schemas)

Step-3: Shutdown MySQL

Step-4: Add the following lines to (/etc/my.cnf if linux) or (C:\xampp\mysql\data\my.ini if xampp in windows)

[mysqld]
innodb_file_per_table 
innodb_flush_method=O_DIRECT 
innodb_log_file_size=1G 
innodb_buffer_pool_size=4G 
innodb_data_file_path=ibdata1:10M:autoextend 

Note: Whatever you set for innodb_buffer_pool_size, make sure innodb_log_file_size is 25% of innodb_buffer_pool_size.

Step-5: Delete ibdata1, ib_logfile0 and ib_logfile1  

There should only be the mysql schema in data location.

Step-6: Restart MySQL

This will recreate ibdata1 at 10MB (do not configure the option) , ib_logfile0 and ib_logfile1 at 1G each

Step-7: Reload SQLDataBackup.sql into MySQL

ibdata1 will grow but only contain table metadata and intermittent MVCC data. Each InnoDB table will exist outside of ibdata1

Suppose you have an InnoDB table named mydb.mytable. If you go into path/mysql/data, you will see two files representing the table

mytable.frm (Storage Engine Header) 
mytable.ibd (Home of Table Data and Table Indexes for mydb.mytable) 
ibdata1 will never contain InnoDB data and Indexes anymore.

With the innodb_file_per_table option in (/etc/my.cnf if linux) or (C:\xampp\mysql\data\my.ini if xampp in windows), you can run OPTIMIZE TABLE mydb.mytable OR ALTER TABLE mydb.mytable ENGINE=InnoDB; and the file will actually shrink.