Editing Basic commands to get around the Synology Box using the CLI

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 2: Line 2:


==File Management==
==File Management==
===To edit a text file (using vi)===
For info on how to use vi see [[Linux VI Editor|Basic commands for Linux vi Editor]]
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>vi /location_of_file/file_name</pre>
|-
|}
===To go to a directory===
===To go to a directory===
{| border="0" cellpadding="0" style="text-align:left"
{| border="0" cellpadding="0" style="text-align:left"
Line 24: Line 16:
|}
|}


===List contents of Directory===
===List Directory===
{| border="0" cellpadding="0" style="text-align:left"
{| border="0" cellpadding="0" style="text-align:left"
|-
|-
|<pre>dir</pre>
|<pre>dir</pre>
|-
|}
===Count the number of files in the current Directory and its sub-directories===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>find . -type f | wc -l</pre>
|-
|}
===Check size of Directory and sub-directories===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>du -ah /path/to/dir</pre>
|-
|-
|}
|}
Line 92: Line 70:
|-
|-
|<pre>cp -r -p /sourceDirectory /destinationpath</pre>
|<pre>cp -r -p /sourceDirectory /destinationpath</pre>
|-
|}
===Create a uncompressed tar (.tar) archive===
To create a uncompressed (.tar) archive of all files directories and subdirectories in the current directory:
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>tar -cvf archivefilename.tar *</pre>
|-
|}
===Create a compressed tar (.tgz) archive===
To create a compressed (.tgz) archive of all files directories and subdirectories in the current directory:
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>tar -cvzf archivefilename.tgz *</pre>
|-
|-
|}
|}
Line 118: Line 80:
|-
|-
|}
|}
===Unpack .tar.gz archives===
For gzip compressed .tar.gz archives:
For gzip compressed .tar.gz archives:
{| border="0" cellpadding="0" style="text-align:left"
{| border="0" cellpadding="0" style="text-align:left"
Line 161: Line 121:
|-
|-
|<pre>top</pre>
|<pre>top</pre>
|-
|}
===Report disk space usage===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>df</pre>
|-
|-
|}
|}
Line 174: Line 127:
{| border="0" cellpadding="0" style="text-align:left"
{| border="0" cellpadding="0" style="text-align:left"
|-
|-
|<pre>ps</pre>
|<pre>ps –ef</pre>
|-
|}
 
===Show currently open ports and their status===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>netstat -an</pre>
|-
|}
 
===Change Logged in user===
If you are logged in as root you can open a new shell as if you just logged in as another user, substitute xxx with the user name. To return to root session use "exit"
 
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>su – xxx</pre>
|-
|-
|}
|}


===Install a ipkg program package===
===Install program===
Note: This assumes you have already installed ipkg itself.
{| border="0" cellpadding="0" style="text-align:left"
{| border="0" cellpadding="0" style="text-align:left"
|-
|-
Line 202: Line 138:
|}
|}


===Uninstall a ipkg program package===
===Uninstall programs===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>ipkg remove filename</pre>
|-
|}
 
==Restart Services==
 
===apache===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S97apache-user.sh restart</pre>
|-
|}
 
===appletalk===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S81atalk.sh restart</pre>
|-
|}
 
===cron===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S04crond.sh stop
/usr/syno/etc/rc.d/S04crond.sh start</pre>
|}
 
===ftp===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S99ftpd.sh restart</pre>
|-
|}
 
===index===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S66synoindexd.sh restart</pre>
|-
|}
 
===itunes===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S99itunes.sh restart</pre>
|-
|}
 
===mysql===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S21mysql.sh restart</pre>
|-
|}
 
===nfs===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S83nfsd.sh restart</pre>
|-
|}
 
===postgresql===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc/rc.d/S20pgsql.sh restart</pre>
|-
|}
 
===samba===
{| border="0" cellpadding="0" style="text-align:left"
{| border="0" cellpadding="0" style="text-align:left"
|-
|-
|<pre>/usr/syno/etc/rc.d/S80samba.sh restart</pre>
|<pre>ipkg remove file name</pre>
|-
|-
|}
|}


===SSH===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>/usr/syno/etc.defaults/rc.d/S95sshd.sh restart</pre>
|-
|}


==System Information==
==System Information==
Line 315: Line 173:
|-
|-
|<pre>cat /proc/filesystems</pre>
|<pre>cat /proc/filesystems</pre>
|-
|}
===Comprehensive information on the file system format===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>tune2fs -l /dev/hda3</pre>
|-
|-
|}
|}
Line 332: Line 183:
|}
|}


===Check RAID Devices===
===Check Devices===
{| border="0" cellpadding="0" style="text-align:left"
{| border="0" cellpadding="0" style="text-align:left"
|-
|-
|<pre>cat /proc/mdstat</pre>
|<pre>cat /proc/mdstat</pre>
|-
|}
===Check Enviroment Variables===
{| border="0" cellpadding="0" style="text-align:left"
|-
|<pre>env</pre>
|-
|}
===Check what physical and logical disks/partitions you have===
{| border="0" cellpadding="0" style="text-align:left"
|-
|For multibay NASs and more info
<pre>cat /proc/diskstats</pre>
or for all NAS types
<pre>cat /proc/partitions</pre>
or for similar but different info
<pre>fdisk -l</pre>
|-
|-
|}
|}
Line 365: Line 197:
|-
|-
|}
|}
[[Category:SynologyWiki]]
[[Category:ToBeExported]]
Please note that all contributions to wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wiki:Copyrights for details). Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)