To show CPU info on Linux

1
2
lscpu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Architecture:          x86_64 
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 78
Model name: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Stepping: 3
CPU MHz: 800.025
CPU max MHz: 3200.0000
CPU min MHz: 800.0000
BogoMIPS: 6399.87
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-3

Note:

1
2
# The other one
cat /proc/cpuinfo

How to set dynamic IP address on Ubuntu 16.04?

To set dynamic IP address on Ubuntu 16.04, you can follow these steps:

  1. Open the terminal by pressing Ctrl+Alt+T.
  2. Type the command “sudo vi /etc/network/interfaces” and press Enter. This will open the “interfaces” file in the vi text editor with root privileges.
  3. Find the line for the network interface you want to configure (e.g., “iface eth0 inet dhcp”) and ensure that it is configured for “dhcp” for dynamic IP address. If not, change “static” to “dhcp”.
  4. Save and close the file by pressing Ctrl+O, Enter, and then Ctrl+X.
  5. Restart the networking service to apply the changes by typing the command “sudo service networking restart” and pressing Enter.
1
2
3
4
5
6
7
8
9
10
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The Ethernet network interface
auto eth0
iface eth0 inet dhcp

Your network interface should now be configured to obtain an IP address dynamically. You can confirm the change by using the “ip addr show” command and checking for an IP address assigned by DHCP server.ver.

How to disable SELinux on Ubuntu?

To disable SELinux on Ubuntu, follow these steps:

  1. Open the terminal by pressing Ctrl+Alt+T on your keyboard.

  2. Type the following command to install the SELinux management tool:

    1
    sudo apt-get install selinux-utils
  3. Once the installation is complete, run the following command to disable SELinux:

    1
    sudo selinux-disable
  4. Restart your Ubuntu system to apply the changes made.

Note: Disabling SELinux may weaken your system’s security. Only disable SELinux if you know what you are doing or if it is causing issues. It’s recommended to consult with an expert if you are unsure.

How to install and use Git on Ubuntu?

1. Install Git

First, you need to install Git on your Ubuntu system. Open the terminal and run the following command:

1
2
sudo apt-get update
sudo apt-get install git

2. Verify Git installation

Next, you can verify that Git has been installed correctly by running the following command:

1
git --version

This should print the version of Git you just installed. For example, git version 2.25.1.

3. Set your Git username and email

Before you can start using Git, you need to set your username and email address. You can do this with the following commands, replacing “Your Name” and “youremail@example.com“ with your own information:

1
2
git config --global user.name "My Name"
git config --global user.email "myemail@example.com"

4. Create a new Git repository

To create a new Git repository, navigate to the directory where you want to create it and run the following command:

1
git init

This will initialize a new Git repository in the current directory.

5. Add and commit changes

Now that you have a Git repository, you can start adding and committing changes to it. For example, let’s say you make a change to a file called “index.html”. You can add this change to your Git repository with the following command:

1
git add index.html

This will stage the changes you made to the file. Once you’ve added all the changes you want to commit, you can run the following command to commit them:

1
git commit -m "Add changes to index.html"

This will commit your changes with a message describing what you changed.

6. Push changes to a remote repository

If you want to collaborate with others, you can push your changes to a remote Git repository. For example, let’s say you’ve created a repository on GitHub called “myproject”. You can push your changes to this repository with the following command:

1
2
git remote add origin https://github.com/username/myproject.git
git push -u origin master

This will push your changes to the “master” branch of the “myproject” repository on GitHub.

That’s it! These are the basic steps to install and use Git on Ubuntu. Of course, there are many more advanced features and commands you can use, but this should be enough to get you started.ted.

How to use user groups and permissions to manage files and directories?

Step 1: Create a new user group

If you don’t already have a group that you want to use for managing your files and directories, you’ll need to create one. You can use the groupadd command to create a new group. For example, to create a group called developers, you can run the following command:

1
sudo groupadd developers

Step 2: Add users to the group

Once you have created the group, you can add users to it using the usermod command. For example, to add the user johndoe to the developers group, you can run the following command:

1
sudo usermod -a -G developers johndoe

Step 3: Set the group ownership of files and directories

To give the developers group ownership of a file or directory, you can use the chgrp command. For example, to give the developers group ownership of a directory called project, you can run the following command:

1
sudo chgrp developers /path/to/project

Step 4: Set the permissions on files and directories

Finally, to set the permissions on a file or directory, you can use the chmod command. The permissions are typically represented as a series of 3 digits, where each digit corresponds to the permissions for the owner, group, and others. The permissions include read (4), write (2), and execute (1). For example:

1
2
3
4
5
6
7
8
- 7 = read, write, and execute (4 + 2 + 1)
- 6 = read and write (4 +2)
- 5 = read and execute (4 + 1)
- 4 = read only
- 3 = write and execute (2 + 1)
- 2 = write only
- 1 = execute only

To set the permissions on a directory, you’ll typically want to use the chmod command with the -R option to apply the permissions recursively (i.e., to all files and subdirectories within the directory). For example, to give the developers group read and write permissions on the project directory and all its contents, you can run the following command:

1
sudo chmod -R 770 /path/to/project

In the above example, 7 represents read, write, and execute permissions for the owner; 7 represents the same permissions for the developers group; and 0 means no permissions for others.

That’s it! With these four steps, you can use user groups and permissions to effectively manage your files and directories.

How to install Node.js on Ubuntu?

  1. Open the Terminal by either searching for it in the launcher or by using the shortcut Ctrl + Alt + T.

  2. Update your system by running the command:

    1
    sudo apt update
  3. Install the prerequisite packages that are needed to run Node.js:

    1
    sudo apt install curl wget
  4. Download and install the Node.js package by running the following commands. Replace the XX with the version number you wish to install.

    1
    2
    curl -sL https://deb.nodesource.com/setup_XX.x | sudo -E bash -
    sudo apt install -y nodejs

For example, if you want to install version 14, you would enter:

1
2
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install -y nodejs
  1. Verify the installation using the following command:
    1
    node -v
    This should display the version number of Node.js that you have installed on your system.

That’s it! You have successfully installed Node.js on your Ubuntu system.

How to install Samba server on Ubuntu?

  1. First, open up the terminal on your Ubuntu machine.

  2. Update your system’s package list using the following command:

1
sudo apt update
  1. Once the package list is updated, you can install Samba server by running the following command:
1
sudo apt install samba
  1. During the installation process, the system will prompt you to configure your Samba server. You can select “No” to the first option (“WINS support”) and “Yes” to the second option (“Create a new Samba configuration file”).

  2. Once the installation is complete, you can open up the configuration file using your preferred text editor. Here’s an example using the built-in Nano editor:

1
sudo nano /etc/samba/smb.conf
  1. In the configuration file, you can define shared directories and set up authentication. Here’s an example of how you can define a sample shared directory:
1
2
3
4
[Shared Folder]
path = /srv/samba/share
read only = no
guest ok = yes

In this example, “Shared Folder” is the name of the share that you want to create, “/srv/samba/share” is the path to the directory you want to share, “read only” is set to “no” so users can write to the share, and “guest ok” is set to “yes” to allow unauthenticated access.

  1. Once you have defined your shares in the configuration file, you can restart the Samba server using the following command:
1
sudo systemctl restart smbd

That’s it! You should now have a working Samba server on your Ubuntu machine.

How to install an FTP server on Ubuntu?

  1. Open up a terminal window on your Ubuntu machine. You can do this by clicking the “Activities” button located at the top left corner of the screen and typing “terminal” into the search bar that appears.

  2. Update the package index and upgrade the system using the following commands:

1
2
3
sudo apt-get update

sudo apt-get upgrade
  1. Install the FTP server software. We will use the popular vsftpd package. You can do this by running the command:
1
sudo apt-get install vsftpd
  1. Once the installation is completed, open the vsftpd.conf file using your favourite text editor. Here we will use nano:
1
sudo nano /etc/vsftpd.conf
  1. Make changes to the configuration file to suit your needs. Here, we will only make two changes.

First, uncomment the line write_enable=YES to enable uploading files.

Second, you may set the anonymous_enable setting to NO allowing only authenticated user to use the FTP server.

1
2
3
write_enable=YES

anonymous_enable=NO
  1. Save and close the configuration file.

  2. Restart the FTP server for the changes to take effect by running the following command:

1
sudo service vsftpd restart
  1. Finally, test the FTP server by connecting to it using an FTP client such as FileZilla, WinSCP or Cyberduck.

That’s it! You now have an FTP server installed on Ubuntu and ready to use.

How to install Nginx server on Ubuntu?

  1. First, open the terminal by pressing Ctrl+Alt+T on your keyboard.

  2. Update the package list using the following command:

    1
    sudo apt-get update
  3. Install Nginx using the following command:

    1
    sudo apt-get install nginx
  4. Once the installation is complete, start the Nginx service using the following command:

    1
    sudo systemctl start nginx
  5. Verify that Nginx is running by entering the server’s IP address or http://localhost in your web browser. You should see the Nginx default landing page.

  6. If you want to make sure that Nginx starts automatically at boot time, run the following command:

    1
    sudo systemctl enable nginx

Congratulations! You’ve successfully installed Nginx on Ubuntu.

Here’s an example of what the default landing page looks like when you navigate to the IP address of your server in a web browser:

nginx_default_page