Basic commands to get around the Synology Box using the CLI
Jump to navigation
Jump to search
File Management
[edit | edit source]To edit a text file (using vi)
[edit | edit source]For info on how to use vi see Basic commands for Linux vi Editor
vi /location_of_file/file_name |
To go to a directory
[edit | edit source]cd /directoryName |
Make a directory
[edit | edit source]mkdir /directoryName |
List contents of Directory
[edit | edit source]dir |
Count the number of files in the current Directory and its sub-directories
[edit | edit source]find . -type f | wc -l |
Check size of Directory and sub-directories
[edit | edit source]du -ah /path/to/dir |
Find a file
[edit | edit source]find / -name fileName |
Delete a file
[edit | edit source]rm fileName |
Delete a directory and its content
[edit | edit source]rm -r directoryName |
- Note: Use this command with great care
Move or Rename a file
[edit | edit source]mv /sourceDirectory/sourceFile /destination |
Copy a file
[edit | edit source]cp /sourceDirectory/sourceFile /destination |
Copy groups of files
[edit | edit source]cp /sourceDirectory/*.* /destination |
Copy a directory and any sub directories
[edit | edit source]cp -r -p /sourceDirectory /destinationpath |
Create a uncompressed tar (.tar) archive
[edit | edit source]To create a uncompressed (.tar) archive of all files directories and subdirectories in the current directory:
tar -cvf archivefilename.tar * |
Create a compressed tar (.tgz) archive
[edit | edit source]To create a compressed (.tgz) archive of all files directories and subdirectories in the current directory:
tar -cvzf archivefilename.tgz * |
Unpack .tar archives
[edit | edit source]For uncompressed .tar archives:
tar xvf file.tar |
Unpack .tar.gz archives
[edit | edit source]For gzip compressed .tar.gz archives:
tar xvzf file.tar.gz |
System Management
[edit | edit source]Reboot the Synology box
[edit | edit source]reboot |
Shutdown the Synology box
[edit | edit source]poweroff |
Stop a process
[edit | edit source]kill processID |
Stop a program
[edit | edit source]killall programName |
Display most current processes running
[edit | edit source]top |
Report disk space usage
[edit | edit source]df |
Show all current processes
[edit | edit source]ps |
Show currently open ports and their status
[edit | edit source]netstat -an |
Change Logged in user
[edit | edit source]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"
su – xxx |
Install a ipkg program package
[edit | edit source]Note: This assumes you have already installed ipkg itself.
ipkg install fileName |
Uninstall a ipkg program package
[edit | edit source]ipkg remove filename |
Restart Services
[edit | edit source]apache
[edit | edit source]/usr/syno/etc/rc.d/S97apache-user.sh restart |
appletalk
[edit | edit source]/usr/syno/etc/rc.d/S81atalk.sh restart |
cron
[edit | edit source]/usr/syno/etc/rc.d/S04crond.sh stop /usr/syno/etc/rc.d/S04crond.sh start |
ftp
[edit | edit source]/usr/syno/etc/rc.d/S99ftpd.sh restart |
index
[edit | edit source]/usr/syno/etc/rc.d/S66synoindexd.sh restart |
itunes
[edit | edit source]/usr/syno/etc/rc.d/S99itunes.sh restart |
mysql
[edit | edit source]/usr/syno/etc/rc.d/S21mysql.sh restart |
nfs
[edit | edit source]/usr/syno/etc/rc.d/S83nfsd.sh restart |
postgresql
[edit | edit source]/usr/syno/etc/rc.d/S20pgsql.sh restart |
samba
[edit | edit source]/usr/syno/etc/rc.d/S80samba.sh restart |
SSH
[edit | edit source]/usr/syno/etc.defaults/rc.d/S95sshd.sh restart |
System Information
[edit | edit source]Check system memory info
[edit | edit source]cat /proc/meminfo |
Check CPU Info
[edit | edit source]cat /proc/cpuinfo |
Check Interrupts in use
[edit | edit source]cat /proc/interrupts |
Check File Systems in use
[edit | edit source]cat /proc/filesystems |
Comprehensive information on the file system format
[edit | edit source]tune2fs -l /dev/hda3 |
Check Linux Version
[edit | edit source]cat /proc/version |
Check RAID Devices
[edit | edit source]cat /proc/mdstat |
Check Enviroment Variables
[edit | edit source]env |
Check what physical and logical disks/partitions you have
[edit | edit source]For multibay NASs and more info
cat /proc/diskstats or for all NAS types cat /proc/partitions or for similar but different info fdisk -l |
Miscellaneous
[edit | edit source]Clear terminal screen
[edit | edit source]clear |