Below is a list of useful commands to know in Linux.
TABLE OF CONTENTS
1. LSPCI
Lspci (list PCI) is a command that displays information about each PCI bus on the system the command has been run on.
The command will show a brief overview of information related to each of the PCI devices that are discoverable.
To run lspci you will need to first download it by entering in the following command "sudo apt install pciutils" this will install lspci for you on the ubuntu/Debian distro.
You then can use "sudo lspci" to look up all devices plugged into the PCI bus on the system. lspci can be linked with a couple of other commands to get a more refined search. One of these is using grep to search up words.
2. Grep
Grep (Global regular expression) lets you find a word in a file and will print only the lines that match with the search word. This can be anything from the full word "Broadcom", part of the word "Broad" or a couple of letters "Bro".
As above the grep command can be used along side other commands. In this case it has been used along with the lspci command to grab a specific device in plugged into a PCI lane.
The "-i" use above is to tell lspci to display the output as a ID list instead of .ids
3. LSSCSI
lsscsi is a command in Linux terminal that list all the disks that are managed using the kernal SCSI subsystem.
This includes all SATA disks connected to the onboard SATA ports that are situated on the board as well as any PCI SATA adapters. This includes RAID Cards, PCI adapter cards that add more SATA ports.
To download lsscsi use the following command "sudo apt install lsscsi".
There are two ways to run lsscsi that can be useful to display the information of the SATA devices. The first way is to run "sudo lsscsi" this will output one line for each device that is attached to the system. Another way to print the output for lsscsi is to run "sudo lsscsi -s" this will print out the output for each device in short form.
4. IPMITOOL
IPMItool is a command that lets you access & enable IPMI devices/ functionality though the Linux terminal. IPMItool lets you manage the systems hardware components, monitor sensors and system health as well and manage and monitor the system environment separate from using the OS.
To install IPMItool you can use the following command "sudo apt install ipmitool"
Once installed we can use IPMItool to check what users are enabled via the following "sudo ipmitool user list 8" this will print a list of users for the IPMI.
In the example above there is has listed 10 users but there are currently only 2 with names and have access. The users on 1-3 currently have admin rights on the IPMI. The user that we usually enable and change password on is user 2.
How to change password with IPMItool
Sometimes units will come back and the IPMI is unable to be reachable due to the IPMI password being changed or user 2 being disabled.
To enable user two and to change the password you can follow the following steps.
First you will need to load up the terminal and use "sudo ipmitool user set password 2 admin" This will set the password for user 2 in the list to be admin. This command can be useful if the ipmitool is unreachable with the default password (admin/admin123).
Once the password has been set you should see a message 'Set User Password command successful (user 2).
The other command we use in conjunction with set password is "sudo ipmitool user enable 2"
This will set the callin, Link Auth set to true so that user 2 are able to access the IPMI.
Troubleshooting ipmitools not working
If you are getting an error when trying to enter ipmitool commands such as - "Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory" you will need to update the depository for ubuntu via 'sudo apt update' as well as manually loading three modules for ipmitools to work.
These modules are:
- ipmi_devintf
- ipmi_si
- ipmi_msghandler
To load these modules up you will need to add modprobe before each of them. Once these are loaded you can run 'lsmod | grep ipmi', this command will show you if the modules are running. If they are not you might have to restart the unit for them to take effect.
Soft Reset of the IPMI
ipmitool mc reset warm
5. CHMOD
Chmod is a command that lets you change the permissions of a file. The file can have the permissions set to r (Read), w (Write) & x (executable). The most common way we will be using chmod is to be running it to make a file an executable.
To make a file an executable you will need to do the following command "chmod +x 'file'"
Once the file you want has been made an executable file you can run it by using the ./ notation. This will run the file as an executable in the terminal.
6. APT, YUM & PACMAN
All Linux distros will use a package management suite to managed installing, updating and uninstalling packages.
Debian-based distros (Linux and Ubuntu) use the apt command to install packages.
To install packages in Debian-based OS you will need to use the following command "sudo apt install ..." if you have administrate rights you can subtract the sudo from the start of the command.
To install packages on Red Hat-based distros (Fedora, CentOS) you will need to use the yum command.
The command line to use is "sudo yum install ..."
To install packages with the last distro; Arch-based (Manjaro, Arco Linux) you again substitute the apt/yum with pacman.
Arch-based OS have a different way of installing packages compared to Red Hat or Debian OS. The following command is needed to install packages "sudo pacman -s ...".
Linux Commands Useful to Know
sudo su ; gives the privileges of the user as a “super user” (ADMIN)
ifconfig ; lists all the IP addresses and MAC addresses
ip a ; lists all the IP addresses and MAC addresses
ipmitool lan print ; lists the IPMI mac address and the IP address ( might not be accurate )
ipmitool fru edit 0 field p 4 “(EXACTA SERIANL NO.)” ; changes the Serial number Via Blackcore tools key
ipmitool fru print; lists the fru details.
sfboot boot-type=disabled boot-image=disabled ; Disables booting to solarflare cards.
sfboot boot-type=all ? boot-image=all ; Enable booting to the solarflare cards
sfupdate --w ; updates the firware on all adapters.
lspci; searches and lists all the PCI devices ( anything connected via the PCI brackets)
lspci | grep -i “search for name of device” ; searches a similar match in the device name that would be listed when using lspci command.
sudo hostnamectl set-hostname “(device name)” ; Changes the name of the unit (usually used in linux red hat software)
nmtui ; brings up a GUI to edit the enp5s0f port on the unit
init 0 ; turns of the unit with a hard stop
reboot ; restarts the unit.
[tab] idle=poll ; using the Blackcore tools key on a unit with a 11900k in it.
Dhclient -v
There are the following different methods are available that can be used to enable and disable your network interface in Ubuntu:
- ifconfig command.
- nmcli command.
- systemctl command.
- nmtui command.
- Ip command.
- ifdown/ifup.
Access BMC from RMA or locked out of BMC
sudo su
ipmitool user list 8
ipmitool user enable 2
ipmitool user set password 2 admin
ipmitool mc reset warm
Bel-air commands
sudo fdisk -l ; Used to show the RAID groups
sudo vgcreate [filepath] ; for Belair it will most likely be lansat / dev / sdb (Create new lv group)
sudo lvcreate -n data -l 100%FREE lansat ; creates the primary partition
sudo mkfs.ext4 -m0/dev/lansat/data ; creates file system
sudo mount /dev/mapper/lansat-data/data ; (mounts the drive)
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article