Admin - Pin a 'Usefull Terminal Commands' post?

  • Hi there

    Is there any interest in Pinning a post here ‘‘Usefull Terminal Commands’’ to help the Newbies, and folk like myself that can’t remember them all?

    Have things like…


    sudo apt-get update


    sudo apt-get update
    sudo apt-get dist-upgrade

    The raspian system will update its lists and upgrade all applications found


    sudo apt-get clean

    Cleans up after downloads.

    All the

    sudo apt-get ‘whatever’

    commands can be replace by

    sudo apt ‘whatever’

    apt does the same as apt-get but provide a progress bar in addition


    sudo reboot


    sudo shutdown -h

    Means NOW!

    Shutdown is a command that turns off the computer and that can be combined with variables such as -h, for halt after shutdown, or -r, for reboot after shutdown.


    sudo shutdown -h 01.20

    Means shut down at 1.20



    is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces. After that, it is usually only needed when debugging or when system tuning is needed.


    df /:

    displays the amount of disk space available on the file system containing each file name argument. With no file name, available space on all currently mounted file systems is shown.


    df -h

    info on available disk space

    df [option(s)] [directory]

    The df (disk free) command, when used without any options, displays information about the total disk space, the disk space currently in use, and the free space on all the mounted drives. If a directory is specified, the information is limited to the drive on which that directory is located.



    shows the number of occupied blocks in gigabytes, megabytes, or kilobytes — in human-readable format


    Type of file system (ext2, nfs, etc.)

    du [option(s)] [path]

    This command, when executed without any parameters, shows the total disk space occupied by files and subdirectories in the current directory.


    Displays the size of each individual file


    Output in human-readable form


    Displays only the calculated total size



    displays the total amount of free and used physical memory and swap space in the system, as well as the buffers and cache used by the kernel.

    The command free displays information about RAM and swap space usage, showing the total and the used amount in both categories.


    Output in bytes


    Output in kilobytes


    Output in megabytes


    hostname -i

    shows ip of Pi


    sudo apt-get purge

    delete a download


    apt-get autoremove

    Remove un-needed leftovers after an install

    To install a github module

    cd ~/MagicMirror/modules


    git clone

    Or all together…

    ~MagicMirror/modules/ $ git clone


    sudo apt-get update ; sudo apt-get upgrade

    to do both at same time, but if after you hit Y and it says abort, do just one at a time


    sudo rpi-update

    To update Pi firmware


    sudo rm

    OR … enter full path of what you want removed- eg:-

    sudo rm -rf /etc/opt/AlexaPi


    cd ~/MagicMirror
    rm -rf modules/module_to_delete

    rm [option(s)] file(s)

    Removes the specified files from the file system. Directories are not removed by rm unless the option -r is used.


    Deletes any existing subdirectories


    Waits for confirmation before deleting each file.


    sudo apt-get install nmap


    sudo nmap -v -A

    to scan some other machines on your network


    arecord -f cd -D plughw:0 -d 10 a.wav

    to record a .wav file recording made with your microphone


    netstat -a

    to view your listening ports.
    Netstat provides information and statistics about protocols in use and current TCP/IP network connections. It is a helpful forensic tool in figuring out which processes and programs are active on a computer and are involved in network communications.

    To perform an update of the magicmirror itself you open a terminal and change into the magicmirror folder with

    cd ~/MagicMirror

    and run git pull.

    Afterwards you run

    npm install



    configures a network interface/enables a network connection.



    shuts down a network interface/disables a network connection.



    Netconfig configures a network, enables network products and displays a series of screens that ask for configuration information.



    allows a user to enter a host name and find the corresponding IP address. A reverse of that process to find the host name is also possible.



    Passwd updates a user’s authentication tokens (changes their current password).



    is used to get a snapshot of everything in a system and to report information on such items as processes, memory, paging and CPU activity. This is a good method for admins to use to determine where issues/slowdown in a system may be occurring.


    mount [option(s)] [] mountpoint

    This command can be used to mount any data media, such as hard disks, CD-ROM drives, and other drives, to a directory of the Linux file system.


    mount read-only

    -t filesystem

    Specifies the file system. The most common are ext2 for Linux hard disks, msdos for MS-DOS media, vfat for the Windows file system, and iso9660 for CDs.

    For hard disks not defined in the file /etc/fstab, the device type must also be specified. In this case, only root can mount.
    If the file system should also be mounted by other users, enter the option user in the appropriate line in the /etc/fstab file (separated by commas) and save this change.

    umount [option(s)] mountpoint

    This command unmounts a mounted drive from the file system. To prevent data loss, run this command before taking a removable data medium from its drive. Normally, only root is allowed to run the commands mount and umount. To enable other users to run these commands, edit the /etc/fstab file to specify the option user for the respective drive.


    kill [option(s)] process ID

    Unfortunately, sometimes a program cannot be terminated in the normal way. However, in most cases, you should still be able to stop such a runaway program by executing the kill command, specifying the respective process ID (see top and ps).

    kill sends a TERM signal that instructs the program to shut itself down. If this does not help, the following parameter can be used:


    Sends a KILL signal instead of a TERM signal, with which the process really is annihilated by the operating system. This brings the specific processes to an end in almost all cases.

    killall [option(s)] processname

    This command is similar to kill, but uses the process name (instead of the process ID) as an argument, causing all processes with that name to be killed.


    halt [option(s)]

    To avoid loss of data, you should always use this program to shut down your system.

    reboot [option(s)]

    Does the same as halt with the difference that the system performs an immediate reboot.


    This command cleans up the visible area of the console. It has no options.

    If there are mistakes here please point them out so I can edit them, and while you are here reading this, why not add to the list? It is for the benefit of new users… like what you were, once ! ;-)
    I’m sure newbies, and not so newbies like my fine self, would benefit from it, as a reference point ;-)

  • @johnnyboy Thanks for this one ;-)

  • @michael24h

    Your welcome… ;-)

  • Module Developer

    Alot of these aren’t just MM terminal commands they are Linux commands and go out and read how to run Linux and it will clear most of that right up for you ;)

  • @cowboysdude

    Yeah, fair point Amigo… but these commands are what I have had to use at some point or another/or what I’ve read as being used to find a specific solution… mostly because of MM problems, and problems on the (linux) Pi it runs on… that has to be set up first before adding MM.

    Most of these I had to spend quite some time searching for, in many, many other places/forums… time that would have been better spent on actually fixing my specific problem straight away… if only there was a One-Stop place to find the specific command to seek out a possible solution to a specific problem.

    If this Forum had such a list, the majority of my problems, and possibly other users problems too, would probbably be solved 99% quicker.

    We all know, understandably, that questions on here may not be answered for quite a long time… and in some cases never at all, which obviously leaves the poster in limbo… unable to move foward with a fix to try… and waiting for the unknown action to try within terminal.

    So if there was such a list that newbies could use, it would gain them immediate answer, that they would not have to wait for.

    This is the only place in the universe that caters to MagicMirror problems, so people have to come here for an answer to thier problems… and the proper commands to use are unknown to a lot of the newbies.

    This list is, as stated - just an example of what could be pinned for newbies… and for not so newbies with not so good a memory for remembering every command to use, as a reference point.

    The end user may only use certain commands once or even twice… so it never is memorised… unlike the Admins-Mods-Devs, that have these commands hard coded into thier brains, having used them repetitivly thousands upon thousands of times.

    After all, quite a lot of posters here have never ever used linux, or a Pi, and have only made the MM because of what it is… and may never be interested in, or learning more about, linux, after building MM…

    My reason for taking my time posting this thread, was purely for the benefits of newbies… to help them!
    It is just an ‘example’ for the Admins to consider as a pinned post…

  • Module Developer

    When this first came out I installed it blindly… I had NO idea what I was doing. I was getting all kinds of errors and I would take one at a time, go out on the internet and read what the error was, what it meant and how to fix it. Then I would fix it. I did this until I got MM working.

    Like any other ‘project’ the person assumes the responsibility to have some knowledge or the ability to go find that knowledge. The people that created this understood what it all meant and yes newbies may not but they must also be prepared to learn to expand their own knowledge base.

  • @cowboysdude

    Like any other ‘project’ the person assumes the responsibility to have some knowledge or the ability to go find that knowledge.

    Indeed… and where better to find specific MagicMirror knowledge than on the ‘only’ MagicMirror forum there is?

    The people that created this understood what it all meant and yes newbies may not

    My point exactly ;-) … the Pi is all about learning… and the MM is, what MM is…
    And this Forum is the place to come to for Help… Help in the form of Experienced users who know, or indeed should know, what it feels like knowing absolutely nothing… as a good few posters here have said in thier very first post about knowing nothing about the Pi, and nothing about linux!

    They come here for help… and to ask questions, and some of that questions are about which commands to use… because there are multitudes of commands.

    Some of these posters do not care to, or cannot for whatever reason, go trawling the internet for several hours looking for one specific terminal command for MagicMirror… and again, this would be the very place to come to, yes?

    Should encouraging people to come here for their answer to which terminal command to be used in MagicMirror really be debated here?

    but they must also be prepared to learn to expand their own knowledge base.

    And where better to expand thier MagicMirror knowledge than here?
    Surely this Forum only exists because of the people that come here seeking help?
    Should that people have to go trawling through countless sites for spurious information, rather than gain such information here?

    Should people here simply not answer a question or try and help, but simply tell the person seeking knowledge about MagicMirror to “Learn to expand their own knowledge base” elsewhere by trawling the internet?

    Indeed, the internet is crammed full of forums for people to learn about linux, and such… and indeed they should be encouraged to “Learn to expand their own knowledge base” regarding other things… but… all i have offered here is my opinion, on whether Admin would be interested in pinning a post for newbies or not, in regards to which terminal commands to use regarding MM… nothing else!

    If the posters want to expand their knowledge on other points, then they can indeed expand that elsewhere… but surely, unless I am mistaken here, this forum should be for MagicMirror related problem solving? And helping complete newbies who know nothing at all about this… ( you have yourself read the posts and seen where posters know absolutely nothing about the Pi, linux , or MM, and have then given them the terminal command required, yes?)

    This post has already helped at least 1 person… many more may have read it and found it offered a command they were unaware of… and even if this post has helped just 1 person, then compiling it has been more than worth it… No?

    So why has this post, offering help and assistance to said newbies, been seen as anything other than what its intention was - to Help?

  • All the sudo apt-get whatever command can be replace by sudo apt whatever apt does the same as apt-get but provide a progress bar in addition.

    Also you put two point 14. And the first one is missing a step and there is a a space missing.
    cd ~/MagicMirror should be cd ~/MagicMirror/modules and ~MagicMirror/modules/ $ gitclone should become ~MagicMirror/modules/ $ git clone
    But maybe instead of maybe it would be easier to say moduleUrl or something ? because the url doesn’t onlt content the url of the module but also who did it. So if somebody who never used git before try to write for example, it will fail. because part of the url is missing.

  • @romain
    Thanks… I have now edited them.
    I just C&P them from my file onto here which I have for hints and tips I see in posts… so never noticed the mistakes so thanks for pointing them out ;-)

Log in to reply

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.