ubuntu/linux and came around quite a good deal of usefull
commands. I wanted to make a register of my most used terminal commands
when fidling with problems in ubuntu/xbmc
IMPORTANT: Linux is CaSe sensitive so if a you e.g type in
the command Df -h nothing will happen because
the command is df - h with lower case characters. The same
applies to directories and files.
A nice general guide to the linux bash world:
http://ubuntuforums.org/showpost.php?p=3...ostcount=1
How to get into the linux terminal ?
U can do this 2 ways. The first is by using your local
keyboard and tv directly. If you have xbmc on the screen
you cant press CTRL ALT F2 to open a bash window
To get back to xbmc you can hit CTRL ALT F7
The way i prefer to do it is by logging into my linux box remotely
from my windows laptop. Both your xbmc box and laptop must be on the same subnet to get it working:
Download putty, it's a small free SSH/Telnet client
http://www.chiark.greenend.org.uk/~sgtat...nload.html
Get the version that matches your windows build
When installed open putty.exe and type in your xbmc box ip adress
and port 22. Save it for later use by hitting the save button (create a name for the connection in the saved session field first)
Load your XBMC saved session by double clicking it from the list
You should now be greeted with a terminal window asking you for a password
General info commands
(does not change anything and should be harmless)
Check Disk Space:
Code:
df -hCheck what linux distro you are using:
Code:
lsb_release -aCheck what linux kernel you have:
Code:
uname -aGet info about a package installed:
Code:
dpkg -s xbmcList all usb devices connected:
Code:
lsusbCode:
lsusb -vTo generaly test your sound using aplay:
Code:
aplay /usr/share/sounds/alsa/Front_Center.wav
aplay /usr/share/sounds/alsa/Front_Left.wav
aplay /usr/share/sounds/alsa/Front_Right.wav
aplay /usr/share/sounds/alsa/Rear_Center.wav
aplay /usr/share/sounds/alsa/Rear_Left.wav
aplay /usr/share/sounds/alsa/Rear_Right.wav
aplay /usr/share/sounds/alsa/Side_Left.wav
aplay /usr/share/sounds/alsa/Side_Right.wav
aplay /usr/share/sounds/alsa/Noise.wavMore Speaker Testing:
Code:
speaker-test -Dplug:surround51 -c6 -l1 -twavList your soundcard device:
Code:
cat /proc/asound/cardsCode:
aplay -lList out all hardware detected:
Code:
lspci -v | lessGet all boot-time kernel logging for a system:
Code:
dmesg | lessSame as above but also with timestamps:
Code:
less /var/log/kern.logTo see what version of nvidia drivers installed:
Code:
dpkg --status nvidia-current | grep Version | cut -f 1 -d '-' | sed 's/[^.,0-9]//g'Basic terminal commands:
To run a command with superusers privileges:
Code:
sudo "command"with elevated priviliges
If you need to do extensive work as root you can do the following:
This way you keep your current users bash config and history
Code:
sudo -sOr you can change to root user all together:
Code:
sudo suBe warned though, running commands inside a terminal
with root privileges is a fast way to fubar your system !!
More info about sudo:
https://help.ubuntu.com/community/RootSudo
To return to your current users home directory from anywhere:
Code:
cd ~To list content of a folder:
Code:
lsTo navigate to a folder:
Code:
cd /etc/X11Edit files:
Code:
nano /etc/X11/xorg.confchanging anything hit CTRL X
To create new file:
Your home dir is located under /home/"your username"
On a standard xbmc live install if you logon in the terminal as user xbmc your homedir is /home/xbmc
In my examples i use /home/xbmc
Code:
nano /home/xbmc/mytestfile.txtType in something in the file and hit CTRL X and nano will now ask
if you want to save changes - select Y and ENTER
The file is now saved.
To delete a file:
Code:
rm /home/xbmc/mytestfile.txtTo create a directory:
Code:
mkdir /home/xbmc/testdirTo remove a directory and all files subdirs:
Code:
rmdir /home/xbmc/testdirTo start/stop a program:
Code:
service xbmc stopCode:
service xbmc-live stopCode:
service xbmc startCode:
service xbmc-live startAnother way to force a program to shutdown is by using the kill command:
Code:
sudo kill -9 `pidof xbmc.bin`To check your wired network info:
Code:
ifconfigTo check your wireless network info:
Code:
iwconfigTo scan wireless networks:
Code:
iwlist scanTo restart the network:
Code:
/etc/init.d/networking restartto restart networking services. It will also renew your dhcp leases
Turning Network interfaces on/off
Sometimes when troubleshooting it can be handy to quickly take network interfaces up/down
to reinitialize the interface
Usually your wired network adapter will be "eth0" and your wirelss netowrk adapter will be "wlan0"
You can use the iwconfig to get a valid list.
Code:
iwconfig eth0 downCode:
iwconfig eth0 upCode:
iwconfig wlan0 upCode:
iwconfig wlan0 downTo shutdown your linux box:
Code:
sudo haltCode:
sudo shutdown -h nowTo reboot your linux box:
Code:
sudo rebootUsefull commands:
Warning these commands can change your system
so do not run them unless you need to. Use it as a refference only !
To update/upgrade your installed packages:
Code:
sudo apt-get updatesCode:
sudo apt-get upgradethis can break functionallity so be carefull !
To update/upgrade specific package:
Code:
sudo apt-get install xbmcCode:
sudo apt-get install xbmc-liveand if there is a newer version it will ask you if you want to upgrade.
To uninstall a package:
Code:
sudo apt-get uninstall xbmcCode:
sudo apt-get uninstall xbmc-liveTo completely remove a package and all dependencies:
Code:
sudo apt-get --purge remove xbmcCode:
sudo apt-get --purge remove xbmc-liveAnother way to remove packages can be:
Code:
sudo dpkg --purge xbmcCode:
sudo dpkg --purge xbmc-liveTo free up disk space and get rid of left behind packages:
Code:
sudo apt-get autoremoveCode:
sudo apt-get autocleanTo search for a package:
Code:
apt-cache search xbmcTo fix broken installs/packages:
Code:
sudo apt-get install --fix-brokenCode:
sudo dpkg --configure -aTo upgrade your current linux distro to a newer version:
Code:
sudo apt-get dist-upgradeand make backups of anything imporant. I have done this a few times
with no problems, however this is not always possible depending on your config/setup
Okay this is what i currently remember from my head, i will ad more
if i see something is forgotten. And as always any input to my list
is welcome ! Also please report if you find something you don't like
or if you have any commands you think should be here


?
Search
Help