Some tasks may require the skills of working with the Linux command line. This is easy enough if you know the basic commands which Linux-server understands.
Interaction with the server takes place via SSH protocol, so if you are running Microsoft Windows, you will need to install a program to work with SSH (Linux and Mac OS doesn’t require additional installations):
Upload file to server:
wget http://www.cloudhosting.lv/filename.zip
Processes list:
top
Processes list of a certain user:
top –u user-name
Currnet date:
date
Change password:
passwd
Change password of a certain user:
passwd user-name
Show information about core:
uname -a
Show information about CPU:
cat /proc/cpuinfo
Show information about memory:
cat /proc/meminfo
Show information about disc usage:
df
Restart certain service:
/etc/init.d/service-name restart
Information about memory usage and swap:
free
Possible application location:
whereis application-name
Server restart (full reboot):
Reboot
Create tar.gz-archive:
tar czf archive-name.tar.gz directory-name
Unpack the tar.gz-archive:
tar xzf archive-name.tar.gz
Create tar.bz2-archive:
tar cjf archive-name.tar.bz2 directory-name
Tar.bz2-unpacking archive:
tar xjf archive-name.tar.bz2
Unpack the rar-archive:
unrar x archive-name.rar
List of files and folders:
ls
Full list of files and folders, including hidden:
ls -a
Change directory:
cd directory-name
Examples of use:
Create folder:
mkdir folder-name
Delete folder or file:
rm file-name
Delete files and folders recursively (including all attached files and folders):
rm -r folder-name
Copy file:
cp file-name copy-file-name
Copy folder:
cp -r folder-name copy-folder-name
Rename file:
mv file-name new-file-name
If «new-file-name» — is a folder, file will be moved to its folder.
Create symbolic link:
ln -s file-name link-name
Change permission (CHMOD) to file or folder:
chmod 755 folder-name
Change permission (CHMOD) to all files recursively:
find . -type f | xargs chmod 644
Change permission (CHMOD) to all files with specific extension recursively:
find . -name '*.cgi' -type f | xargs chmod 755
Change permission (CHMOD) to all folders recursively:
find . -type d | xargs chmod 755
Data base backup with mysqldump (command must be in one line):
mysqldump --user=USERNAME --host=HOST -acnqQ --single-transaction
--default-character-set=ENCODING --password=PASSWORD -- DATA_BASE
| sed s#^CREATE TABLE# IF NOT EXISTS# ; s#^INSERT INTO#REPLACE INTO#
| gzip -qf9c > /home/username/directory-where-backups-will-be-stored/data-base-name-
`date +%Y-%m-%d`.sql.gz
Encoding example: cp1251, utf8.
Performing Perl-script:
perl script-name.cgi
Perl module installation through CPAN:
install MODULE: :NAME
Before doing this you must enter into CPAN, entering next command:
perl -MCPAN -e shell