LinuxCommandHowTo
What is it?
Wireless related commands for the beginner (or the forgetful).
This is not a complete list and is not intended as a subsitute for the manual (man man) nor the time tested method of experimentation.
It is instead, a list of useful command line entries (or observations) that will help to kickstart the puzzled newbie into using wireless on Linux effectively.
It concentrates on the CLI as that's the base most of the GUI's work from, it's also always there.
If you're after more then the Rute User's Tutorial and Exposition is one of many resources for an introduction to Linux.
Feel free to add to it...
CLI
Command Line Interface - Which means you're sitting at a terminal (of some sort) and entering text strings at the prompt. You may be physically at the computer or remotely accessing it via SSH or a serial console.
Self Help
man
- man <command> - help pages for any command/appliciation. Also has help pages for some related configuration files too.
- man man - review what the man help system does
apropos
- apropos <query> - search the manual descriptions for <query>
- apropos route - return manuals that consider route to be in their "domain"
info
- info - review what the info help system does
- pinfo - a "colorful viewer"
-h --help
help switches, add either the short format -h or the long format --help after a command to get help on it.
Networking Commands
pcmcia_cs (card--- commands)
PCMCIA Card Services - generally starts on system boot up or may be
manually started using /etc/init.d/pcmcia and displayed arguments
(RedHat, Fedora, Debian and others)
If it's not running on start up the chkconfig or setup can be used under RedHat, Fedora to check the start configuration. (What is it under Debian?)
- cardctl eject -- ejects all cards
- cardctl eject 0 - ejects first card
- cardctl eject 1 - ejects secondcard
- cardctl ident - identify a card. Useful when changing the default driver, by editing /etc/pcmcia/config, /etc/pcmcia/config-2.4 or /etc/pcmcia/host_cs.conf and changing the module the manfid binds to.
If problems are experienced in ejecting a card, the interface may need to be brought down first. Programs such as dhclient may be blocking the card and preventing a clean exit.
ifup, ifdown
- ifdown wlan0 - shutdown the wlan0 interface
- ifup wlan0 - start the wlan0 interface
- also see ifconfig
ifconfig
- ifconfig - return configuration of ethernet devices
- ifconfig eth0 - eth0 values only
- ifconfig eth0 up - start the eth0 interface
- ifconfig eth0 down - shutdown the eth0 interface
wireless-tools (iw--- commands)
- iwconfig - displays all interfaces (the ifconfig of wireless cards)
- iwconfig wlan1 - displays wlan1 only
- iwconfig <if#> txpower <#/#mW> - for cards that support, changes transmit power (NB: If using mW, don't forget the suffix)
- iwlist scan -- scans from all supported cards and reports stats on accesspoints or clients found
- iwlist wlan0 scan - scans for nodes (only from wlan0)
- iwpriv wlan0 hostscan # - then issue dmesg to check results - it peforms a quick scan of wireless nodes
- 1 = send Probe Request at 1 Mbps
- 2 = send Probe Request at 2 Mbps
- 3 = send Probe Request at 5.5 Mbps
- 4 = send Probe Request at 11 Mbps
To perform MAC filtering (deny), use the following two commands:
- iwpriv wlan1 maccmd 2 - implement a deny policy (see the README in the Hostap tarball)
- iwpriv wlan1 addmac 00:00:c8:2f:ae:53 - to exclude a specific MAC address. Then use the following to verify the above input (if using hostap)
- cat /proc/net/hostap/wlan1/ap_control - which should return...
- MAC policy: deny
- MAC entries:1
- MAC list:
- 00:00:c8:2f:ae:53
ip
supplied by the iproute or iproute2 package. A (minimum) 2.2 kernel is usually required and the package may need to be manually installed.
- There is no manual page, use ip help instead
- ip a display address's
- ip a help - further help for address's
- ip r display routes (also review the route command)
- ip r help further route help
- ip a a 10.10.146.58/30 dev eth0 label eth0:0 - add a virtual interface to dev eth0
- ip l s eth0 mtu 1200 - change the mtu to 1200
route
- route -n - display routes without resolving names (no names = quicker)
System Commands
dmesg
display the kernel messages. Useful immediately after boot up or at any time that the OS messages may need reviewing. ie: You have (computer based) problems
ps
show running processes
options - too many to list - review the manual.
- ps -adelf - a fairly complete long listing. Needs wordwrap to review effectively . Try redirecting
- ps axf - a threaded listing
mod-utils
Commands centred around modules (drivers). Not usually needed except when first installing a card, that is not automatically detected.
- lsmod list running modules
- insmod ne2k-pci - load the module ne2k-pci (realtek cards)
If errors are reported back about missing dependencies then look in /lib/modules/<kernel_version>/modules.dep, find the module you're trying to load and see what else is mentioned on that line, in this case it's 8390. Load 8390 first then load ne2k-pci and all should be okay.
Other Commands
Terminal Shortcuts
<Alt>
<Alt> F1, <Alt> F2 etc will change consoles. Usually up to 7 consoles are preconfigured, the number can be changed in /etc/inittab. Reduce the number for a headless, low memory machine.
<Shift> <page_up>
Use scroll back on current console. The scroll back on the current terminal (console) will be lost when changing to another console.
Unsurprisingly <Shift> <page_down> has a similar effect
<Tab>
Enter the start of a command at the prompt then use <Tab> to complete the typing. If more than one result would be possible then <Tab><Tab> to list them all.
Installing or Building packages
apt
- apt-get install <package name> - a very easy to use package installer/uninstaller originally for Debian. Simply type the command and the name of the application (package) you want and apt will download it, install it and configure it for you. Apt is available for some rpm distributions as an add on package, yum is an equivalent now installed by default in Fedora.
- apt-cache search <search pattern> - a quick way to find and list packages with short descriptions for Debian. Try something like apt-cache search wireless and see what you get.
- apt-cache show <package name> - show the version, size, full description and so forth for a package.
emerge
- emerge <application name>- a very easy to use application installer/uninstaller found in Gentoo. Simply type the command and the name of the application (package) you want and portage will download it, compile it, install it and configure it for you. Edit /etc/make.conf to setup exactly how you want your applications compiled.
Misc - but still important
enable forwarding
Routers must have this set, firewalls will often set it within their scripts.
The scripts or whatever will all write either 0 (false) or 1 (true) to /proc/sys/net/ipv4/ip_forward.
Read it using...
- cat /proc/sys/net/ipv4/ip_forward
Write to it (and enable forwarding) with...
- echo 1 > /proc/sys/net/ipv4/ip_forward and check with the previous cat command
/proc
Directory of running processess and their configuration variables. When you edit a config file and run the application, this is where those changes are stored (close enough?)
- cat /proc/interrupts - show irq's in use (and thus check, resolve clashes)
- cat /proc/pci - show results found for pci bus (slots). ie: detected values for pci cards such as ethernet, video, cradles
- cat /proc <TAB><TAB> - use command completion to display all files in proc directory, pick one and cat it
redirection
redirect output to another place
- eg ps -adelf > /tmp/dump
- less /tmp/dump - line wrapping (from the above command) is now viewable.
/var/log
When something goes wrong, and no messages are returned - look here (it's a directory).
Look here anyway and become familar with the layout and what is captured.
- /var/log tells all (that it knows about anyway).
GUI
Graphical User Interface
Is there a point in listing GUI applications? I can't picture describing the mouse shortcuts, but the section is here if there's a need.
Version 11 (current) modified Mon, 26 Jul 2021 12:49:29 +0000 by
tyson [EditText] [Spelling] [Current] [Raw] [Code] [Diff] [Subscribe] [VersionHistory] [Revert] [Delete] [RecentChanges]