viernes, 24 de enero de 2014
miércoles, 15 de enero de 2014
Linux command
Delete a file - rm command syntax
rm (short for remove) is a Unix / Linux command which is used to delete files from a filesystem. Usually, on most filesystems, deleting a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place). The syntax is as follows:
rm -f -r {file-name}
Where,
- -f: Forcefully remove file
- -r: Remove the contents of directories recursively
Remove or Delete a File
To remove a file called abc.txt type the following command:
$ rm abc.txt
To remove all files & subdirectories from a directory (MS-DOS deltree like command), enter:
$ rm -rf mydir
To remove empty directory use rmdir and not rm command:
$ rmdir mydirectoryHow do I Find Out Linux CPU Utilization?
Whenever a Linux system CPU is occupied by a process, it is unavailable for processing other requests. Rest of pending requests must wait till CPU is free. This becomes a bottleneck in the system. Following command will help you to identify CPU utilization, so that you can troubleshoot CPU related performance problems.
Finding CPU utilization is one of the important tasks. Linux comes with various utilities to report CPU utilization. With these commands, you will be able to find out:
* CPU utilization
* Display the utilization of each CPU individually (SMP cpu)
* Find out your system's average CPU utilization since the last reboot etc
* Determine which process is eating the CPU(s)
* Display the utilization of each CPU individually (SMP cpu)
* Find out your system's average CPU utilization since the last reboot etc
* Determine which process is eating the CPU(s)
Old good top command to find out Linux cpu load
The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.
The top command monitors CPU utilization, process statistics, and memory utilization. The top section contains information related to overall system status - uptime, load average, process counts, CPU status, and utilization statistics for both memory and swap space.
The top command monitors CPU utilization, process statistics, and memory utilization. The top section contains information related to overall system status - uptime, load average, process counts, CPU status, and utilization statistics for both memory and swap space.
Top command to find out Linux cpu usage
Type the top command:
$ top
Delete / Remove a Directory Linux comand
rmdir command - Deletes the specified empty directories.
rm command - Delete the file including sub-directories.
Syntax- rmdir command
The rmdir command remove the DIRECTORY(ies), if they are empty. The syntax is:
rmdir directory-name
rmdir [option] directory-name
rmdir [option] directory-name
Examples
Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to remove a directory called /tmp/docs:
rmdir /tmp/docs
If a directory is not empty you will get an error:
$ rmdir lettersHowTo: Use grep Command In Linux / UNIX – Examples
How do I use grep command on Linux, Apple OS X, and Unix-like operating systems? Can you give me a simple examples of the grep command?
The grep command is used to search text or searches the given file for lines containing a match to the given strings or words. By default, grep displays the matching lines. Use grep to search for lines of text that match one or many regular expressions, and outputs only the matching lines. grep is considered as one of the most useful commands on Unix and other Linux operating systems.
Did you know?
The name, "grep", derives from the command used to perform a similar operation, using the Unix/Linux text editor ed:
g/re/p
g/re/p
The grep command syntax
The syntax is as follows:
grep 'word' filename grep 'word' file1 file2 file3 grep 'string1 string2' filename cat otherfile | grep 'something' command | grep 'something' command option1 | grep 'data' grep --color 'data' fileName
How do I use grep command to search a file?
Search /etc/passwd file for boo user, enter:
Sample outputs:
$ grep boo /etc/passwdSample outputs:
foo:x:1000:1000:foo,,,:/home/foo:/bin/ksh
You can force grep to ignore word case i.e match boo, Boo, BOO and all other combination with the -i option:
The grep command is used to search text or searches the given file for lines containing a match to the given strings or words. By default, grep displays the matching lines. Use grep to search for lines of text that match one or many regular expressions, and outputs only the matching lines. grep is considered as one of the most useful commands on Unix and other Linux operating systems.$ grep -i "boo" /etc/passwdDid you know?
g/re/pThe grep command syntax
grep 'word' filename
grep 'word' file1 file2 file3
grep 'string1 string2' filename
cat otherfile | grep 'something'
command | grep 'something'
command option1 | grep 'data'
grep --color 'data' fileName
How do I use grep command to search a file?
$ grep boo /etc/passwdSample outputs:
Sample outputs:
foo:x:1000:1000:foo,,,:/home/foo:/bin/ksh
$ grep -i "boo" /etc/passwdviernes, 3 de enero de 2014
PowerShell Script | FTP Upload files
PowerShell Script | FTP Upload files
Sometimes we need to copy files from a Server to an FTP. In my schema I need to move files from a File Server to a FTP server.
Searching for internet I found an easy PowerShell script to do it.
martes, 31 de diciembre de 2013
Exchange 2013 | Email Forwarding
Email Forwarding
Sometimes we need to forward an email account to another account.
For example when a user is OOO, or when a user leaves the company and sombady else needs to receive the emails that sent to the first one.
So, in order to setup that we have 2 choices.
- Using Power Shell
- Using EAC (Exchange Admin Center)
1- Using Power Shell
This example forwards all email sent to the mailbox of Ken Sanchez to pilarp@contoso.com.
Set-Mailbox -Identity "Ken Sanchez" -ForwardingAddress "pilarp@contoso.com"
This example delivers email to the mailbox of Dan Park and at the same time forwards all mail sent to Dan Park to danpark.parents@fineartschool.net.
Set-Mailbox -Identity "Dan Park" -ForwardingAddress "danpark.parents@fineartschool.net" -DeliverToMailboxAndForward $true
When a mailbox is created, the value of the DeliverToMailboxAndForward parameter is set to
$false by default. When you use the EAC to configure mail forwarding, this value isn't changed. This means that email sent to the user's mailbox is sent to the forwarding address and not copied to the user's mailbox. If you want messages to be delivered to both the mailbox and the forwarding address, you have to set the DeliverToMailboxAndForward parameter to $true.2- Using EAC (Exchange Admin Center)
- In the EAC, navigate to Recipients > Mailboxes.
- In the list of user mailboxes, click the mailbox that you want to configure mail forwarding for, and then click Edit
.
- On the mailbox properties page, click Mailbox Features.
- Under Delivery Options, click View details to view or change the setting to forward email messages sent to the user to another recipient.
- Select the Enable forwarding check box and then click Browse.
- On the Select Mail User and Mailbox page, select a recipient to whom you want to forward all email messages that are sent to this mailbox.
- Click OK, and then click Save to save your changes.
viernes, 29 de noviembre de 2013
MCSA: Windows Server 2012 (Microsoft Certified Solutions Associate)
MSSA: Microsoft Certified Solution Associate or System Administrator? It's a mess!
Before to start I would like to explain the difference between Microsoft Certified Solutions Associate (MCSA) certifications.
MCSA (Microsoft Certified Solutions Associate) is a certification program intended for people who seek entry-level jobs in an IT (information technology) environment. MCSA is a prerequisite for more advanced Microsoft certifications.
The MCSA credential supplants the now defunct Microsoft Certified Systems Administrator certification. Students could choose between difference technologies, for instance:
- Windows Server 2012
- SQL Server 2012
- Windows 8
As they advance in the MCP program, professionals can gain any or all of the following certifications:
- Microsoft Certified Systems Engineer (MCSE)
- Microsoft Certified Solutions Developer (MCSD)
- Microsoft Certified Product Specialist (MCPS)
- Microsoft Certified Trainer (MCT)
To prepare for the MCP exams, students can take courses at a certified training company location, in certified courses in a high school or college, or through self-study at Microsoft's self-study Web site or through certified training materials. Students who do not feel ready for MCSA can obtain the more basic MTA (Microsoft Technology Associate) certification first.
To clarify this mess, you could check the Microsoft IT Certification Roadmap and find your path :)
Now, How can I get my Windows Server 2012 MSCA?
Well, in order to get the Windows Server 2012 MSCA the students will need to pass three Certification Exams.
There are:
Well, if you have a little of experience administering Windows Server 2008/2012 the two first certification won't be a big deal, maybe the student will need to study a little more for the last one, Configured Advanced Windows Server 2012, because there you will see a lot of new and strategics stuff to use with Windows Server 2012.
There are:
- MS-20410: Installing and Configuring Windows Server 2012 (More info)
- MS-20411: Administering Windows Server 2012 (More info)
- MS-20412: Configured Advanced Windows Server 2012 (More info)
Well, if you have a little of experience administering Windows Server 2008/2012 the two first certification won't be a big deal, maybe the student will need to study a little more for the last one, Configured Advanced Windows Server 2012, because there you will see a lot of new and strategics stuff to use with Windows Server 2012.
A bit of help to study
To prepare for the exam, the student could use a tool that emulate the exam that you need to pass. With same questions and the same methodology of Microsoft exams ... multiple choice.
This tool is called: Visual CertExam Suite
In the other hand we will need the Exams ... in order to get them you will need to download it from http://www.examcollection.com/
So, lets go to work:
- Download and install the Visual CertExam Suite from here.
- Now we need to download the Exams from ExamCollection
- MS-20410
- MS-20411
- MS-20412
So, we haven't any excuse now. Lets go to study and to be an MCSA :)
viernes, 26 de abril de 2013
MySQLDUMP Import - Export a data base
phpMyAdmin can be used to export or backup MySQL databases easily. However, if the database size is very big, it probably won’t be a good idea. phpMyAdmin allows users to save database dump as file or display on screen, which involves exporting SQL statements from the server, and transmitting the data across slower network connection or Internet to user’s computer. This process slow the exporting process, increase database locking time and thus MySQL unavailability, slow the server and may simply crash the Apache HTTPD server if too many incoming web connections hogging the system’s resources.
The better way to backup and export MySQL database is by doing the task locally on the server, so that the tables’ data can be instantly dumped on the local disk without delay. Thus export speed will be faster and reduce the time MySQL database or table is locked for accessing. This tutorial is the guide on how to backup (export) and restore (import) MySQL database(s) on the database server itself by using the mysqldump and mysql utilities. There are basically two methods to backup MySQL, one is by copying all table files (*.frm, *.MYD, and *.MYI files) or by using mysqlhotcopyutility, but it only works for MyISAM tables. Below tutorial will concentrate on mysqldump which works for both MyISAM and InnoDB tables.
How to Export or Backup or Dump A MySQL Database
To export a MySQL database into a dump file, simply type the following command syntax in the shell. You can use Telnet or SSH to remotely login to the machine if you don’t have access to the physical box.
mysqldump -u username -ppassword database_name > dump.sql
Replace username with a valid MySQL user ID, password with the valid password for the user (IMPORTANT: no space after -p and the password, else mysqldump will prompt you for password yet will treat the password as database name, so the backup will fail) and database_name with the actual name of the database you want to export. Finally, you can put whatever name you like for the output SQL dump file, here been dump.sql.
The while data, tables, structures and database of database_name will be backed up into a SQL text file named dump.sql with the above command.
How to Export A MySQL Database Structures Only
If you no longer need the data inside the database’s tables (unlikely), simply add –no-data switch to export only the tables’ structures. For example, the syntax is:
mysqldump -u username -ppassword –no-data database_name > dump.sql
How to Backup Only Data of a MySQL Database
If you only want the data to be backed up, use –no-create-info option. With this setting, the dump will not re-create the database, tables, fields, and other structures when importing. Use this only if you pretty sure that you have a duplicate databases with same structure, where you only need to refresh the data.
mysqldump -u username -ppassword –no-create-info database_name > dump.sql
How to Dump Several MySQL Databases into Text File
–databases option allows you to specify more than 1 database. Example syntax:
mysqldump -u username -ppassword –databases db_name1 [db_name2 ...] > dump.sql
How to Dump All Databases in MySQL Server
To dump all databases, use the –all-databases option, and no databases’ name need to be specified anymore.
mysqldump -u username -ppassword –all-databases > dump.sql
How to Online Backup InnoDB Tables
Backup the database inevitable cause MySQL server unavailable to applications because when exporting, all tables acquired a global read lock using FLUSH TABLES WITH READ LOCK at the beginning of the dump until finish. So although READ statements can proceed, all INSERT, UPDATE and DELETE statements will have to queue due to locked tables, as if MySQL is down or stalled. If you’re using InnoDB, –single-transaction is the way to minimize this locking time duration to almost non-existent as if performing an online backup. It works by reading the binary log coordinates as soon as the lock has been acquired, and lock is then immediately released.
Syntax:
mysqldump -u username -ppassword –all-databases –single-transaction > dump.sql
How to Restore and Import MySQL Database
You can restore from phpMyAdmin, using Import tab. For faster way, upload the dump file to the MySQL server, and use the following command to import the databases back into the MySQL server.
mysql -u username -ppassword database_name < dump.sql
The import and export of MySQL database not only is important to recover the data when disaster strikes, but also provides an easy way to migrate or move to another server, such as when switching web hosting providers. However, do note that one common problem – character set encoding. Newer release of mysqldump uses UTF8 as its default charset if nothing is specified, while older versions (older than 4.1 typically) use Latin1 as default characterset. If you database charset is Latin1 and dump in UTF8 collation, the data may ends up become simply rubbish, garbled, or unreadable (frequently happen with WordPress blog). If this case, use –default-character-set=charset_nameoption to specify the character set or convert the database to UTF8.
How do I import data stored in a .sql file (created by mysqldump command) under UNIX or Linux operating systems?
The syntax is as follows to import the data created by mysqldump command:
The syntax is as follows to import the data created by mysqldump command:
mysql -u {DB-USER-NAME} -p {DB-NAME} < {db.file.sql} mysql -u {DB-USER-NAME} -h {MySQL-SERVER-HOST-NAME} -p {DB-NAME} < {db.file.sql}
In this example import a file called sales.sql for salesdb1 user and sales db, enter:
If database salesdb1 does not exists, first create it and than import it as follows:
$ mysql -u sales -p salesdb1 < sales.sqlIf database salesdb1 does not exists, first create it and than import it as follows:
$ mysql -u root -p -e 'create database salesdb1'
$ mysql -u sales -p salesdb1 < sales.sqlMount a pendrive !!
Assume the pendrive is /dev/sda1 and you want to mount it at /media/pendrive, then you should be able to mount it as a priveleged user with
There is a wrapper called pmount that, IIRC, the Debian folks created to allow non-priveleged users to mount things such as pendrives. This might be something you want to install for mom. If you use pmount, the command would be
Additionally, you might want to create and alias so mom doesn't need to type so much
Then mom just executes the command pen to mount the pendrive.
Code:
mount /dev/sda1 /media/pendrive
Code:
pmount /dev/sda1 /media/pendrive
Code:
alias pen='mount /dev/sda1 /media/pendrive'
Suscribirse a:
Entradas (Atom)

