Synology: Basic Command Lines For DSM 7

Synology Basic Command Lines For DSM 7

A Linux command line is a text interface to your Synology NAS. Often referred to as the shell, terminal, console, prompt or various other names, it can give the appearance of being complex and confusing to use. This little guide will teach you some basic command lines for your DSM 7, to become familiar with SSH. Let’s assume there’s no prior knowledge, but by the end I hope you’ll feel a bit more comfortable the next time you’re faced with some instructions that begin with “Open a terminal” and log into your NAS. Note: DSM is a Linux operating system for Synology DiskStation and RackStation products.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Follow my step by step guide on How to SSH into a Synology NAS or you can use the Task Scheduler (Example here) after that, try some basic command lines below.
Note: Be careful! Use only the command lines you need.

File Management on DSM 7

To edit a text file (using vi)

vi /location_of_file/file_name

To go to a directory

cd /directoryName

To make a directory

mkdir /directoryName

List contents of directory


Count the number of files in the current directory and its sub-directories

find . -type f | wc -l

Check size of directory and sub-directories

du -ah /path/to/dir

Find a file

find / -name fileName

Delete a file

rm fileName

Delete a directory and its content

rm -r directoryName

Move or Rename a file

mv /sourceDirectory/sourceFile /destination

Copy a file

cp /sourceDirectory/sourceFile /destination

Copy groups of files

cp /sourceDirectory/*.* /destination

Copy a directory and any sub-directories

cp -r -p /sourceDirectory /destinationpath

Create an uncompressed tar (.tar) archive

To create an uncompressed (.tar) archive of all files, directories and subdirectories in the current directory:

tar -cvf archivefilename.tar *

Create a compressed tar (.tgz) archive

To create a compressed (.tgz) archive of all files, directories and subdirectories in the current directory:

tar -cvzf archivefilename.tgz *

Unpack .tar archives

For uncompressed .tar archives

tar xvf file.tar

Unpack .tar.gz archives

For gzip compressed .tar.gz archives

tar xvzf file.tar.gz

System Management on DSM 7

Reboot your Synology NAS device 


Shutdown your Synology NAS device


Stop a process on your Synology NAS

kill processID

Stop a program on your Synology NAS

killall programName

Display most current processes running on your Synology NAS


Report disk space usage on your Synology NAS


Show all current DSM processes


Show currently open ports and their status on your Synology NAS

netstat -an

Change Logged in user on your Synology NAS

If you are logged in as root/admin 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 the command line “exit”.

su – xxx

Install an IPKG program package

Note: Install IPKG.

ipkg install fileName

Uninstall an IPKG program package

ipkg remove filename

Restart Services on DSM 7


/usr/syno/etc/rc.d/ restart


/usr/syno/etc/rc.d/ restart

Cron and Crond

/usr/syno/etc/rc.d/ stop
/usr/syno/etc/rc.d/ start
systemctl restart crond
systemctl restart synoscheduler


/usr/syno/etc/rc.d/ restart


/usr/syno/etc/rc.d/ restart


/usr/syno/etc/rc.d/ restart


/usr/syno/etc/rc.d/ restart


/usr/syno/etc/rc.d/ restart


/usr/syno/etc/rc.d/ restart


/usr/syno/etc/rc.d/ restart


/usr/syno/bin/synosystemctl restart sshd.service


/usr/syno/bin/synosystemctl stop sshd.service


/usr/syno/bin/synosystemctl disable sshd.service


/usr/syno/bin/synosystemctl enable sshd.service


/usr/syno/bin/synosystemctl start sshd.service

System Information on DSM 7

Check system memory info

cat /proc/meminfo

Check CPU Info

cat /proc/cpuinfo

Check Interrupts in use

cat /proc/interrupts

Check the current File Systems in use

cat /proc/filesystems

Comprehensive information on the file system format

tune2fs -l /dev/hda3

Check the Linux Version of your DSM

cat /proc/version

Check RAID Devices

cat /proc/mdstat

Check Environment Variables


Check what physical and logical disks/partitions you have in a multi-bay NAS

cat /proc/diskstats

or for all NAS types

cat /proc/partitions

or for similar, but different info

fdisk -l

Miscellaneous for DSM 7

Clear terminal screen


Note: The command line above also works perfectly with DSM 6.2.4

This post was updated on Thursday / August 25th, 2022 at 11:57 PM