Sunday, May 9, 2021

How to install, update or delete font in Linux

Sometimes we need some extra fonts for creative work. Font installing is a very simple process. Follow the following step to install Fonts.

 


Step 1: Download or Arrange Font 

 Keep your font file ready. In my case, I download the font file from the internet. It's Zip File so extract it using Unzip Command.


Step 2: Install the Fonts

    In Linux, font binaries  are located either in system directory /user/share/fonts/ or user local font directory which is ~/.local/share/fonts/.

 I prefer ~/.local/share/fonts/ directory because I did not want this font available to other users.

When I check ~/.local/share directory fonts directory is not available so first I create it.


[yogesh@lap ~]$ mkdir  ~/.local/share/fonts


Move  Downloaded File to this fonts directory.

[yogesh@lap Downloads]$ mv Anurati_Free_Font.zip ~/.local/share/fonts/
Then I extract it using unzip command
[yogesh@lap fonts]$ unzip Anurati_Free_Font.zip 
Step 3: Clear and Regenerate Your font Cache

Next, Clear and regenerate your fonts cache using the following command.

[yogesh@lap fonts]$ fc-cache -f -v

Step 5: Verify the Installation

Confirm that the fonts are installed by displaying the paths and style definitions with the fc-list executable filtered on the font family name with grep
[yogesh@lap fonts]$ fc-list | grep -i Anurati
/home/yogesh/.local/share/fonts/ANURATI Free Font/Anurati-Regular.otf: Anurati:style=Regular

Now you  can open office and check your font.


Wednesday, March 17, 2021

 How to Find files in a specific range.

Find command is a faster way to retrieve the files. it is better than ls. ls is slower when the number of files increased. 

 Find the Files OLDER than X days on Linux

Command Syntax

find /path/to/files -mtime +<number of days> -printf '%T+ %p\n' [| sort -r | head -100 ]

Note that there are spaces between rm, {}, and \;

Explanation 

1. path/to/files -  This argument takes the path where your files are located.

2. mtime - This argument specifies how older files you want to find. i.e. -mtime +4 means - find the files which are older than 4 or more days.

3. -printf - This argument print files to console %T and %p  and \n is used for new lines.
Optional Part
4. | pipe - used to input-output of the first command to others.

5. sort - This command sort the output of the find command 
6. head - This command shows only a specified range of values.


Find Files created in the Last X days

Command Syntax

find /path/to/files -mtime -<number of days> -printf'%T+ %p\n' 

To Delete files created in the last x days only change -mtime argument it takes -<number of days> rather +<number of days>

Find Files older than x minutes

Command Syntax

find /path/to/files -mmin +<minutes> -printf'%T+ %p\n' 

Delete files created in x minutes

Command Syntax

find /path/to/files -mmin -<minutes> -printf'%T+ %p\n' 

 

Delete Files using Find Command on Linux

Note - > Before  Deleting files by using find command -exec option you must ensure that files are correct. How to find files in a specific range.

 Delete Files OLDER than X days on Linux

Command Syntax

find /path/to/files -mtimes +<number of days> -exec rm {} \;

Note that there are spaces between rm, {}, and \;

Explanation 

1. path/to/files -  This argument takes the path where your files are located.

2. mtimes - This argument specify how older file you want to find. i.e. -mtimes +4 means - find the files which are older than 4 or more days.

3. -exec  - This command execute the argument passed to it. Here the argument is rm which remove the files. you can use -f option to forcefully remove the files. {} \; are mandatory this is the end of the command.

Delete Files created in Last X days

Command Syntax

find /path/to/files -mtimes -<number of days> -exec rm {} \;

To Delete files created in the last x days only change -mtimes argument it takes -<number of days> rather +<number of days>

Delete Files Older than x minutes

Command Syntax

find /path/to/files -mmin +<minutes> -exec rm {} \;

Delete files created in x minutes

Command Syntax

find /path/to/files -mmin -<minutes> -exec rm {} \;

Friday, March 5, 2021

 How to create RESTRICTED Session in Oracle DB

Apart from Startup nomount , Startup mount, or Startup [open] there is one more mode to start the Oracle DB Instance is 

Startup Restrict 

or 

Alter system enable restricted session;


How can user create session

When database is OPEN  i.e. startup open , users must be grant CREATE SESSION to Connect 

grant create session to yogesh;

When database is restricted mode, users must be grant create session as well as create restrict session.

grant create restricted session to yogesh;

Note - > if user already logged in and dba issue alter system enable restricted session; command then those user remain logged in.


Disable restricted mode

alter system disable restricted session.

Friday, February 12, 2021

 This Blog give the answer of following question which i faced after installing Oracle 12c , Oracle 19c 

Question 1. How to open enterprise manger  like oracle 11g

Question 2. Why emctl not found in $ORACLE_HOME/bin directory

Question 3. How to setup web console / enterprise manager express in Oracle 12c 

Question 4. How to install enterprise manager separately in Oracle 12c


Step by Step i give the answer of these above questions. After installing oracle 12c i faced these issue.

I hope most of you have either already noticed or going to be notice that enterprise manager controller emctl command has been removed from Oracle 12c / Oracle 19c.  This is because from Oracle 12c (cloud) Enterprise Manager come in separate bundle. 

So After completing setup of  Oracle 12c / Oracle 19c , when i tried to run emctl command it show the following error

[oracle@lap ~]$ emctl
bash: emctl: command not found...
[oracle@lap ~]$ find /u01 -type f -name emctl
[oracle@lap ~]$ 
So after little bit research i found the reason that emctl is not shipped with Database package. But we can run express edition of enterprise manager. which have limited functionality basically you can view the report.

So enable enterprise manager express in Oracle 12c or Oracle 19c you need to follow following steps...

Step 1. First check http and https port using gethttpport or gethttpsport funtion of DBMS_XDB_CONFIG package

For http port 

SQL> select dbms_xdb_config.gethttpport from dual;

GETHTTPPORT
-----------
          0

For https port 

SQL> select dbms_xdb_config.gethttpsport from dual;

GETHTTPSPORT
------------
           0

if output of above query are 0 then we need to configure the port and if output are any number than 0 than we don't need to configure these port again.

Step 2. Configure http or https port or both if it not set already i.e. output of above sql query are 0.  For setting http port we use dbms_xdb_config.sethttpport and https port we use  dbms_xdb_config.sethttpsport 


SQL> exec dbms_xdb_config.setHTTPsPort (5500);


PL/SQL procedure successfully completed.


SQL> exec dbms_xdb_config.setHTTPPort(5511);


PL/SQL procedure successfully completed.

Run the first 2 queries again and check for the required output.
SQL> select dbms_xdb_config.gethttpport from dual;


GETHTTPPORT
-----------
       5511


SQL> select dbms_xdb_config.gethttpsport from dual;


GETHTTPSPORT
------------
 5500
This show my enterprise manager express has been configured at my system. To open web console we need to use 

http://localhost:5500/em 
 
or 

 https://localhost:5511/em 

Oracle 12c web console required flash support to open login page for that we need to install flash-plugin.

 Note : Since Adobe no longer supports Flash Player after 31 December 2020 and blocked Flash content from running in Flash Player beginning 12 January 2021, Adobe strongly recommends all users immediately uninstall Flash Player to help protect their systems.