Below is a summary of the most widely used Linux commands.
In the final part I put references to the internet lists more comprehensive.
By this command is possible enter in Super User mode, sometime is necessary use the command: sudo su
Dopo
aver dato il comando su, ci verrą chiesta la password.
The indication that we are Super User is the characther: #
at the end of the prompt line.
example:
root@enrico-MM061:/home/enrico#
For exit from the super user mode use the command: exit
It tells us the disk space (or SD on embedded systems) and the usage of it.
It tell us the size of the RAM and the usage of it.
It tell us the CPU usage and who using it.
For exit use the command: ctrl+c
top
It tell us the active process in real time.
For exit press: ctrl + C
ps aux
It tell us the active process and also show us the relative PID.
ps -ef | grep python
It tell us the active PYTHON process.
Below an example, in the red box there are the PID numbers.
It is used to terminate the active process.
kill <process_number (Num.PID)>
If the process is not generated by you, for kill it use the command: sudo
kill Num.PID
If the process is hard to terminate, use the command: sudo
kill -9 Num.PID
It show the tree process.
It show the HW version
It show the USB device connected to your PC
It show the contents of the directory where you are.
ls -alp
It similar to ls -l but plus it show the iden files.
Examples of ls -l
0123456789 A B C D E F
drwxrwxr-x 2 enrico enrico 4096 gen 6 2013 CNC
-rw-rw-r-- 1 enrico enrico 307018 set 22 00:07 C:\nppdf32Log\debuglog.txt
From left to right, below, the explanation of the result.
0) it tell us if is a file or a directory (d)
1...9) it tell us the permission and means:
r reading
w writing
x execution
- not assigned
The permission are groupped for:
1,2,3)
permissions assigned to the owner
4,5,6) permissions assigned to the group
7,8,9) permissions assigned to all the users
A)
indicates the number of connections to the component while for folders indicates the number of extra blocks.
B)
it is the name of the owner of the file or the directory.
C) is the group membership
D)
dimensions
E) date and time of creation or last modification
It is used to change the permission on files.
In the example below we gave all, all permissions.
chmod
a=rwx <nome_file>
chmod -R <permission> <directory>
It is used to change the directory permission and also the permission on all the files that are in the directory.
The example below gives to all, all permissions:
chmod
-R 777 <directory>
chown <owner or group> <file_name>
It is used to change the proprietary of the files
cp <source_file> <destination_file>
It is used to copy file
It is use to delete the file
<name1> <name2> is file or directory, it is possible that before use this command is necessary login as super user sudo mv <name1> <name2>
This is a scheduler that allows you to run commands at scheduled times or to repeat it with fixed intervals.
See here:
http://en.wikipedia.org/wiki/Cron
and here.
To see my example look here.
It allows us to modify the specified file using the nano editor.
sudo apt-get install <package>
It is used to install the packages.
EXAMPLE:
sudo apt-get install gedit
Install gedit
sudo
apt-get remove <package>
Remove the package and all dependencies not used from other packages.
sudo
apt-get remove <package>
Remove all dependencies not more used from the package.
sudo
apt-get purge <package>
Similar to apt-get remove, but also remove the configuration files related to the package.
sudo
apt-get update
It allows us to update the packages in our system.
If a package requires the installation or removal of new dependencies the package will not be updated by the update command.
To effect these changes will also have to use upgrade command (see below).
sudo apt-get clean
Removes the files are no longer used in our system.
sudo apt-get autoremove
Removes files marked as no longer used
sudo apt-cache search <word>
It is use for find a packages that contain the specified word
sudo apt-cache show <package>
This command show the information regarding the package
sudo
apt-cache depends <package>
This command show the packages that are necessary for a package.
sudo apt-cache showpkg <package>
This command show the version, the reverse depens and the dependecies of a package
Example:
ifconfig
iwconfig
cat /proc/net/wireless
watch -n 1 cat /proc/net/wireless
Wavemon WiFi monitor
iwlist wlan0 scan
It is an utility use to manage the HD,
SD card and USB card.
If your system is not installed, you can install it using the command:
sudo apt-get install gparted
For run it use the command: gparted
LINK:
If nmap is not present on your PC, instal it using this command:
sudo apt-get install nmap
For find the IP of the PC, or of the SmartPhone, or of the RaspBerry Pi, etc, connected to your LAN network, open a terminal (on a PC) and use the command:
nmap -sP 192.168.1.1-255
obviously change the: 192.168.1.1
and use the IP address for your Access Point or Router.
You receive an answer from the nmap command, similar to the image below.
My RaspBerry Pi name is: rpi1.station and the IP is: 192.168.1.5
If you need to know the ports open on an IP address use the syntax below:
sudo apt-get install lm-sensors
for run it use the command below:
sensors
ATTENTION: On RaspBerry Pi to know the temperature of the cpu see here.
I suggest CuteCom and MiniCom, they are available in your Software Center distribution.
Convert package from RPM to DEB and vice versa
For do the conversion is necessary use alien.
If alien is not present on your distribution install it by this command: sudo aptitude install alien
Convert file from RPM to DEB
sudo alien <package.rpm>
Convert file from DEB to RPM
sudo alien -r <package.deb>
http://linux.collectiontricks.it/wiki/Guida_ai_comandi_base_della_shell_in_GNU/Linux