Linux and Ubuntu command

Linux and Ubuntu command

Basic command-:

Uname -: for product name

Uname –I -: for version

Uname –r -: recursive details

 

How to configure IP in Ubuntu



How to change existing configured IP

Bring NIC interface UP and down

nmcli con up id 'Wireless connection 1'


How to install SSH on Ubuntu-;

sudo apt update

sudo apt install openssh-server




SSH service is running type the following command

sudosystemctl status ssh

If after installation still failing to start ssh service please run this command

sudo apt-get purge openssh-server
sudo apt-get install openssh-server
 

 

 

The default setting in Debian (and hence Ubuntu) for OpenSSH Server is to deny password-based login for root and allow only key-based login. Change this line in /etc/ssh/sshd_config:

PermitRootLogin without-password

to

PermitRootLogin yes

And restart the SSH server:

sudo service ssh restart
 

How to change hostname in Ubuntu-:

Open Terminal and use below command

hostnamectl    to check current hostname

to rename hostname use below command

sudo hostnamectl set-hostname linuxize


 

Change Name and press CTRL +O and enter to save

Ctrl+X to exit.

Now change entry in host file as well for that run below command

How to install python in Ubuntu

If you are installing in on fresh installed Ubuntu and you don’t have installed essential package, you will get below error for that first run below command.

Download Python


Extract this file into home directory

Open terminal go to that path i.e


Run below command

Once configuration done run below command to install python

After installation run below command to check default phython version running

Above python has been installed on 7th Oct that is old version

Run below command to check latest version. Go into installation directory and check which version has installed

Now run below command to set default

How to install JAVA JDK

First check which version is latest one and run below command> change only software Name

How to install Apache in Ubuntu

Installation will start once installation will done.

Open browser and type local host or computer IP or 127.0.0.1 and press enter if the page is opening it means it’s working

You can run this command to start and stop apache service


How to check partition size in Ubuntu

Df–h

Here /dev/sda1 define total size and used size

How to create new partition

Now press t for Type-:



 

How to Save Changes in Vim

Vim Save and Quit Command

To save a file and exit Vim:

1. Switch to command mode by pressing the ESC key.

2. Press (colon) to open the prompt bar in the bottom left corner of the window.

3. Type after the colon and hit Enter. This will save the changes and exit.

Vim Save And Quit The Editor Command

Alternatively, a command that will also save a file and exit the text editor is:

:wq

In which case the stands for write (=save) and stands for quit.

 

Exit Without Saving Changes in Vi / Vim

To exit Vim without saving changes:

1. Switch to command mode by pressing the ESC key.

2. Press (colon) to open the prompt bar in the bottom left corner of the window.

3. Type q! after the colon and hit Enter to exit without saving the changes.

 

How to Save a File in Vi / Vim Without Exiting

To save a file without exiting in Vim:

1. Switch to command mode by pressing the ESC key.

2. Type (colon). This will open the prompt bar in the bottom left corner of the window.

example of saving a file without exiting in Vim

3. Type after the colon and hit Enter. This will save in Vim the changes made to the file, without exiting.

You can also rename an existing file by adding the new name after the commands.

:w [newfilename]

In the picture below, we renamed the existing example1.txt into newexample.

example of renaming a file using vi/vim text editor

 

 

 

 

 

·       Cursor movementh, j, k, l (left, down, up, and right)

·       Delete characterx

·       Delete linedd

·       Mode toggleEscInsert (or i)

·       Quit:q

·       Quit without saving:q!

·       Run a shell command:sh (use 'exit' to return)

·       Save file:w

·       Text search

 

 

  



No comments:

Post a Comment

Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...