Projects 2008

Command line for Ubuntu and RedHat

The ones with * may work only in one version. In Ubuntu some commands require sudo before the instruction to have root rights

Sound troubleshooting
*alsamixer

Reset command line
*reset

Kill a process
Find out its pid with: ‘ps -e’ and to kill it: ‘kill -9′

Hide completely Gnome Panel
In gconf_editor: apps/panel/toplevels/button_level_screen0

Restart network
/etc/init.d/networking restart

Users, groups, passwords
useradd UserName
userdel UserName
passwd UserName
groupadd GroupName

Logins
su – : Root
su UserName

Manage the status of programs. For instance, to know the status of nfs type: ‘/etc/init.d/nfs status’
/etc/init.d/ status|start|restart|stop

Copy, delete, rename, find files. For directories include ‘-r’
rm FileName: Delete file
cp file Location/file : Copy file into Location given
mv file Location/file : Remove file and place it onto location given

- Search for name_file in directory_path and its subdirectories
find directory_path -name ‘name_file’
- File’s data was last modified n*24 hours ago. Last time of modification of the file itself
find directory_path -mtime n
- File’s data was last modified n*24 hours ago. Last modification of the inode (file created, mode changed, etc.)
find directory_path -mtime n
- Find files modified last n minutes
find -cmin n
- Like -name, but the match is case insensitive.
find directory_path -iname pattern

Permissions
chmod 666 file_name: read and write rights
chmod 775 file_name: all rights
chmod 700 file_name: make a file executable

Display file info
ls -l : know permissions ls -a: show all files

Network
*/etc/sysconfig/network:SetupHostname
*/etc/sysconfig/network-scripts/ifcfg-eth0: Setup ip address
ifconfig -a: Network info *setup

Installation process to install software
Uncompress package (zip, tar, tar.gz, …See below HowTo Uncompress)
cd package
./configure
make
make check (to make sure the installation is successfully, not necessary)
make install
If installation fails: make clean

PC features
General info: uname -a
Kernel: uname -r
HD: df -h
Memory: free -m
List the existing partitions: fdisk -l

Uncompress:
tar -xvfz filename.tar
tar -xvjf filename.tar.bz2
tar -xvzf filename.tar.gz
unzip filename.zip

*RPM packages
rpm -ivh package.rpm : install
rpm -i packag.rpm : install
rpm -Uvh package.scr.rpm: install
rpm -V package.scr.rpm: Verify
rpm -e package: remove
rpm -e –nodeps package: force remove
rpm -qa package: check if package is installed
rpm -qalgrep package: check if package is installed

GENERAL
pwd: current directory
ps: print status
history | more: history of 1000 last commands by screens
history | grep <topic>: show the commands typed related to <topic>
apropos topic: list of topics related
*ntsysv: run programs at boot time (To check on any service: SPACE)
scp file_name machine_name:directory_destination To copy file_name into machine 10.1.1.0 in the directory tmp ’scp file_name 10.1.1.0:/tmp’

Show all ports open in current machine
netstat -lnptuw *netstat -nap | grep

CommandLinePart2

August 27, 2008 Posted by aes | commands | | No Comments Yet

Command line 2

Set date to 7:30 am 1st October 2015
sudo touch -t 201510010730 file.txt

To display the first 20 lines of a file
head –n 20 file.txt
To display the last 20 lines of a file
tail  –n 20 file.txt

Show System log info
gnome-system-log &

* To remove an application from boot time
/etc/init.d/program stop
chkconfig program off
(only in RedHat)

Some of the following commands, may need to use the pipe more at the end: command | more

lspci: list all PCI devices
lsmod: program that shows the status of modules in the Linux Kernel
iwconfig: show wireless interfaces
/sbin/ifconfig: ip info
du: estimate file space usage

PCI ID
First identify the card you have with lspci and note the first column such as 0000:00:0c.0 and then find out the PCI ID of the card by running lspci -n

To know where drivers are saved
ls -d /lib/modules/$(uname -r)

dmesg: System Log messages

cat as an editor
- cat > file_name
- Enter whatever you need to edit
- ctrl + d: to exit

concatenate instructions
intruction1 && instruction2
For example: ls && ls -a

*system-config-network: Network configuration
ldconfig: creates the necessary links and cache to the most recent shared libraries

type shell instructions in file_name
chmod 755 file_name
./file_name

iptables –nvL: firewall settings

wc: print the number of newlines, words, and bytes in files

Open file browser as root
sudo nautilus

Trace system calls, signals, executables
strace to_be_trace_name, i.e. strace ls

more commands
http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/
http://www.oracle.com/technology/pub/articles/calish_file_commands.html
http://www.ss64.com/bash/

August 9, 2008 Posted by aes | commands | | No Comments Yet