User Tools

Site Tools


software:linux:usefullcommands

command-line client for NetworkManager

nmcli is a command-line client for NetworkManager. It allows controlling NetworkManager and reporting its status. For more information please refer to nmcli(1) manual page.

The purpose of this manual page is to provide you with various examples and usage scenarios of nmcli.

$ nmcli device wifi list

\*  SSID               MODE    CHAN  RATE       SIGNAL  BARS  SECURITY
   netdatacomm_local  Infra   6     54 Mbit/s  37      ▂▄__  WEP
\*  F1                 Infra   11    54 Mbit/s  98      ▂▄▆█  WPA1
   LoremCorp          Infra   1     54 Mbit/s  62      ▂▄▆_  WPA2 802.1X
   Internet           Infra   6     54 Mbit/s  29      ▂___  WPA1
   HPB110a.F2672A     Ad-Hoc  6     54 Mbit/s  22      ▂___  --
   Jozinet            Infra   1     54 Mbit/s  19      ▂___  WEP
   VOIP               Infra   1     54 Mbit/s  20      ▂___  WEP
   MARTINA            Infra   4     54 Mbit/s  32      ▂▄__  WPA2
   N24PU1             Infra   7     11 Mbit/s  22      ▂___  --
   alfa               Infra   1     54 Mbit/s  67      ▂▄▆_  WPA2
   bertnet            Infra   5     54 Mbit/s  20      ▂___  WPA1 WPA2

https://developer-old.gnome.org/NetworkManager/stable/nmcli-examples.html#:~:text=nmcli%20is%20a%20command%2Dline,and%20usage%20scenarios%20of%20nmcli.

ifconfig has been largely replaced by the ip command

2021-01-03

Following some improvements in the kernel and the gradual move to driving network things via netlink; ifconfig has been largely replaced by the ip command. Running just ip yields the following:

I understand this may look complicated to some people, but the jist of it is to understand that with ip, you interact with objects, and apply some kind of function to it. For example:

  ip address show

This is the main command that would be used in place of ifconfig. It will just display the IP addresses assigned to all interfaces. To be precise, it will show you the layer 3 details the interface: the IPv4 and IPv6 addresses, whether it is up, what are the different properties related to the addresses…

Another command will give you details about the layer 2 properties of the interface: its MAC address (ethernet address), etc; even if it is shown by ip address:

  ip link show

Furthermore, you can set devices up or down (similar to ifconfig eth0 up or ifconfig eth0 down) simply by using:

  ip link set DEVICE up or ip link set DEVICE down

From <https://ubuntu.com/blog/if-youre-still-using-ifconfig-youre-living-in-the-past>

command line to list dns servers used by my system

From: https://askubuntu.com/questions/152593/command-line-to-list-dns-servers-used-by-my-system

Ubuntu >= 15

nmcli device show <interfacename> | grep IP4.DNS

Ubuntu <= 14

nmcli dev list iface <interfacename> | grep IP4

sysbench

From: https://www.howtoforge.com/how-to-benchmark-your-system-cpu-file-io-mysql-with-sysbench

2 CPU Benchmark
3 File IO Benchmark
4 MySQL Benchmark

How To Run Gedit And Nautilus As Root With pkexec Instead Of gksu

From: http://www.webupd8.org/2015/03/how-to-run-gedit-and-nautilus-as-root.html

The recommended replacement for gksu is pkexec. Applications like Synaptic, Ubuntu Software Center, 
Software & Updates and others use it for some time but what if you want to use pkexec with applications 
like Gedit or Nautilus?

list of hardware

Find Out BIOS Version Using a Command Line Option

From: https://www.cyberciti.biz/faq/check-bios-version-linux/

sudo dmidecode -s bios-version
dmidecode | less

Linux Force fsck on the Next Reboot or Boot Sequence

Securing iptables

From: http://www.techrepublic.com/blog/10-things/10-iptables-rules-to-help-secure-your-linux-box/ From: http://sharadchhetri.com/2013/06/15/how-to-protect-from-port-scanning-and-smurf-attack-in-linux-server-by-iptables/

Mastering iptables could take a while, but if you have a few rules to cover the basic security 
needs, you'll be well on your way to protecting your Linux system. Jack Wallen explains some key 
rules to get you started.
Also
How to protect from port scanning using iptables

psad: Linux Detect And Block Port Scan Attacks In Real Time

From: http://www.cyberciti.biz/faq/linux-detect-port-scan-attacks/

psad makes use of Netfilter log messages to detect, alert, and (optionally) block port scans and 
other suspect traffic. For tcp scans psad analyzes tcp flags to determine the scan type (syn, fin, xmas, 
etc.) and corresponding command line options that could be supplied to nmap to generate such a scan. In 
addition, psad makes use of many tcp, udp, and icmp signatures contained within the Snort intrusion 
detection system.

Renaming Files Batch

From: http://www.linux-magazine.com/Online/Blogs/Off-the-Beat-Bruce-Byfield-s-Blog/Bulk-Renamers Mar 18, 2011 GMT Bruce Byfield

  pyRenamer
  I have not checked which came first, but GPRename and pyRenamer have almost identical interfaces. 
  The main difference is in the organization of the tabs; pyRenamer has six to GPRename's four, and,
  although GPRename's are more clearly named, pyRenamer, like KRename, has options specific to 
  certain types of files.
  PyRenamer's tabs: Patterns (which can be used to change the types of characters used in file 
  names); Substitutions (common changes, such as spaces to underscores or capitalization); the 
  self-explanatory Insert/Delete; and Images and Music (for renaming these types of file using
  their metadata).
  PyRenamer also makes extensive use of building blocks, but mercifully provides dialogs as a crib, 
  and has the considerable advantage of allowing you to set up multiple renaming options in a single 
  pass. You can also rename files one at a time, before applying all changes.
  A particularly useful option in pyRename is Remove Accents, accessible with one click and 
  helpful in creating files that BASH can use regardless of locales.
  My sole complaint about pyRenamer is that you cannot set up multiple Replace patterns at the 
  same time. However, since you can remain on the Substitutions tab and apply patterns one at a 
  time, the inconvenience is not as great as it might have been. After working with the others, 
  the simplicity and arrangement of pyRenamer makes it my tool of choice for renaming on the desktop.
   

bad fstab entry

openSuse had mounts in fstab that could not be executed because the file system was destroyed by a badly behaving disk. i used this command to reformat the drive. rebooting then allowed the drive to mount.

mke2fs -j /dev/hdb1

tune2fs will configure when the filesystem is rechecked for no corruption.

succesfully installed Java on Firefox

To solve it delete your Java 1.5.0JDK and replace it for a j2sdk1.4.2_07 (that's mine ^^ )

$ ln -s /usr/java/j2sdk1.4.2_07/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so /usr/lib/firefox-<yourversion>/plugins

If you have any browsers running close them and restart after the ln -s

you succesfully installed Java on Firefox

software/linux/usefullcommands.txt · Last modified: 2022/09/10 17:05 by superwizard