Some Linux commands I found useful
To find out the version of the system:
--------------------------------------------------
uname -r -m
To backup and restore a database
-----------------------------------------------------
mysql -u root -p libdata </home/pradeep/Desktop/libuser.sql
To create a database
----------------------------------------------------
mysqladmin -u root -p create libdata
To drop a database
--------------------------------------------------
mysqladmin -u root -p drop libdata
Current folder path
---------------------------------------------------
pwd
Set up a virtual node
----------------------------------------------------
Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example: gksudo gedit /etc/apache2/sites-available/mysite
Change the DocumentRoot to point to the new location. For example, /home/user/public_html/
Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>
You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
Save the file
Deactivate and Activate apache site:
-------------------------------------------------
sudo a2dissite default && sudo a2ensite mysite
Finally, we restart Apache2:
-----------------------------------------------------
sudo /etc/init.d/apache2 restart
Test Apache
---------------------------------------------------------------------
echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html
Finally, browse to http://localhost/
1HYUQLCQMUS4MLJMKEYV53L77N23H66V5HBHVANM61K3B37MK2-08441
.....................................................................
Find php version
-------------------------------------------
php -v
-------------------------------------------------------
You can recover MySQL database server password with following five easy steps.
Step # 1: Stop the MySQL server process.
Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.
Step # 3: Connect to mysql server as the root user.
Step # 4: Setup new mysql root account password i.e. reset mysql password.
Step # 5: Exit and restart the MySQL server.
Here are commands you need to type for each step (login as the root user):
Step # 1 : Stop mysql service
# /etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld.
Step # 2: Start to MySQL server w/o password:
# mysqld_safe --skip-grant-tables &
Output:
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started
Step # 3: Connect to mysql server using mysql client:
# mysql -u root
Output:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Step # 4: Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("root") where User='root';
mysql> flush privileges;
mysql> quit
Step # 5: Stop MySQL Server:
# /etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended
[1]+ Done mysqld_safe --skip-grant-tables
Step # 6: Start MySQL server and test it
# /etc/init.d/mysql start
# mysql -u root -p
----------------------------------------------------------------------------------------------
How to free an audio devise -- http://linux.dsplabs.com.au/lsof-grep-snd-how-to-free-a-linux-sound-device-p25/
lsof |grep snd — how to free a linux sound device
-----------------------------------------------------------------------------------------------
uuencode -- sharutils http://www.gnu.org/software/sharutils/
-----------------------------------------------------------------------------------------------
Restarting networking services
sudo /etc/init.d/networking restart
------------------------------------------------------------------------------------------------
ps -e | grep mysql
------------------------------------------------------------------------------------------------
sudo shutdown -h now
------------------------------------------------------------------------------------------------
M-crypt set-up and installation
------------------------------------------------------------------------------------------------
sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt
------------------------------------------------------------------------------------------------
SEE ALL INSTALLED PACKAGES
------------------------------------------------------------------------------------------------
dkpg --list |grep crypt
dpkg --status mcrypt
Mysql
--------------------------------------------------------------------------------------------------
mplayer -playlist -dumpstream -dumpfile output.ram
SVN
---------------------------------------------------------------------------------------------------
Basic setup
[general]
anon-access = read
auth-access = write
realm = My First Repository
password-db = passwd
:::: To encrypt password ::::
perl -e '$pass="mypasswd"; print crypt($pass, $pass);
http://queens.db.toronto.edu/~nilesh/linux/subversion-howto/
View Package Paths In Red Hat
-------------------------------------------------------------------------------------------------------
rpm -ql <packagename>
Create A File
------------------------------
touch <filename>
Change ownership of file
--------------------------------
chown <username>:<groupname> <file or directory name>
Change file permissions
--------------------------------
chmod 755 <filename>
use -r for recursive application
1-read
2-execute
4-write
Login as
-------------------------------------
su <username>
Change Password
-------------------------------------
passwd
-----------------------------------------------
Dxdiag equivalant
The 'lspci' utility lists devices on the PCI busses in the system.
The 'dmidecode' utility should allow you to get detailed information from your BIOS about your processor, memory, chipsets, etc.
The output of the 'dmesg' command will quite often contain most of the information you want.
The 'glxinfo' command can give you details of the OpenGL capabilities of your hardware.
View Package Paths In Red Hat
-------------------------------------------------------------------------------------------------------
rpm -ql <packagename>
Create A File
------------------------------
touch <filename>
Change ownership of file
--------------------------------
chown <username>:<groupname> <file or directory name>
Change file permissions
--------------------------------
chmod 755 <filename>
use -r for recursive application
1-read
2-execute
4-write
Login as
-------------------------------------
su <username>
Change Password
-------------------------------------
passwd
-----------------------------------------------
Dxdiag equivalant
The 'lspci' utility lists devices on the PCI busses in the system.
The 'dmidecode' utility should allow you to get detailed information from your BIOS about your processor, memory, chipsets, etc.
The output of the 'dmesg' command will quite often contain most of the information you want.
The 'glxinfo' command can give you details of the OpenGL capabilities of your hardware.
Disk space usage
df -h
What is machine's RAM/Memory usage?
free -m
How many physical CPU's?
cat /proc/cpuinfo | grep
"physical id"|sort|uniq|wc –l
How many cores each CPU has?
cat /proc/cpuinfo | egrep
"core id|physical id" | tr -d "\n" | sed
s/physical/\\nphysical/g | grep -v ^$ | sort | uniq | wc –l
Total size of current directory
du -s
What is the OS Name
cat /etc/*release*
To login to service account w/o console
su -s /bin/bash jenkins
cat /etc/*release*
To login to service account w/o console
su -s /bin/bash jenkins
Comments
Post a Comment
Feedback - positive or negative is welcome.