Zu Hauptinhalten wechseln

FV Decipher Unterstützung

Alle Themen, Ressourcen für FV Decipher benötigt.


Common Shell Commands

  Requires Decipher Cloud

1:  Overview

Shell users have access to an abundance of helpful commands. If you're connected to a UNIX system via PuTTY or SSH, you have access to the following UNIX commands.

There are tons of UNIX-related resources on the web. [1] [2] [3]

2:  UNIX Commands

Here's a brief description of some of the most common UNIX commands you may use daily:

Access command documentation: [COMMAND] --help

Command Example Description
cd cd goto home directory
cd [PATH] cd ../parentDir goto path specified
clear clear refresh shell screen
cp [FILE] [NEWFILE] cp survey.xml backup_survey.xml copy file
ls ls list files
ls -l ls -l long list files
ls -al ls -al long list all files
mkdir [DIRNAME] mkdir static create a new directory
mv [FILE] [PATH] mv quota.xls .. move file somewhere
cat [FILE] cat file1.txt file2.txt outputs file(s) content
nano [FILE] nano survey.xml basic text editor
vim [FILE] vim survey.xml awesome text editor
pwd pwd print working directory
rm [FILE] rm SECURE remove file
rm -r [DIR] rm -r static/ remove directory
unzip [FILE] unzip images.zip unzip zipped file
who who list users currently online
grep "TEXT" [FILE] grep "Q1" survey.xml search for text in file(s)
du du -sh disk usage - directory size
exit exit exit shell session
> ls *jpg > images.txt outputs to file
>> ls *png >> images.txt appends to file
| ls | grep "txt" pipes data for further processing

3:  V2 Commands

Decipher's v2 server has some built-in functions to help you manage projects:

Command Description
v2 goto main v2 folder
copy-survey -d today backup project data
copy-survey -m clear clear project data
copy-survey temp-today create project temp directory
copy-survey -s temp-today create project temp directory without data
tsst -q [PROJECT PATH] 100 Run 100 qualified simulated data
tsst -v [PROJECT PATH] 100 Run 100 simulated data, skipping <validate> logic
tsst -q 100 Run 100 qualified simulated data in current directory
update-virtuals reloads the virtual report questions
reload . same as running: touch survey.xml
live [PROJECT PATH] clears data & sets project LIVE
closed [PROJECT PATH] soft close project (active respondents have 1 hour to complete)
closed [PROJECT PATH] now hard close project (kicking out any active respondents)
tabcut list.txt email > emails.txt copy "email" column from list.txt into emails.txt
tabmerge list.txt:source list2.txt:source > sources.txt combines "source" columns file list.txt/list2.txt into sources.txt
allgrep survey.xml "onLoad" search all project survey.xml files for "onLoad"

4:  Quick Tips

Here are some quick tips that aim to increase productivity.

Have a tip, trick or suggestion? Shoot it over to the doc team!

4.1:  Command Aliases (.bashrc)

The ~/.bashrc file is an individual shell startup file that you can use to enhance your shell experience.

There are tons of references on the web regarding bash and the different profiles you can setup, so check them out.

For this tip, let's talk about aliases. Here's a few aliases that you can consider using on Decipher's server.

alias l="ls -al"
alias xx="exit"
alias vi="vim"
alias vir="vim -R"
alias vis="vim survey.xml"
alias virs="vim -R survey.xml"
alias vims="vim -O"
alias ts="touch survey.xml"
alias golive="live . && echo 'CHECK THE COVERAGE REPORT YOU FOOL'"
alias testsurvey="tsst -qv ."
alias clearsurvey="copy-survey -m clear"
alias home="cd ~/"
alias grep="grep --color=auto"

This means that if we type "xx" in the shell, we'll "exit" our session. Here's a small post regarding aliases to learn more from.

4.2:  Easy Directory Navigation

When you're bouncing back and forth from directory to directory, constantly typing cd can be annoying. Here's a couple tips to consider:

The command, cd - , will take you back to your previous working directory.

user@user:~$ cd Desktop
user@user:~/Desktop$ cd -

When you're moving project files around on the server, it can be a hassle (and even problematic) to type out entire project paths. Consider storing directories into a variable!

[user@server tests]$ f=`pwd`
[user@server tests]$ home
[user@server ~]$ p=`pwd`
[user@server ~]$ cd $f
[user@server tests]$ cp -r test1 $p
[user@server tests]$ cd $p
[user@server ~]$ ls | grep test1

In the example above, we used the pwd to store the directory's path in variables, f and p. Then you can reference these paths with the dollar sign, $f and $p.

4.3:  Output to File

Use the > and >> commands to output data to a file. The single > will write to a file, erasing the current content. The >> will append to a file. Consider the following examples:

[user@server static]$ ls *jpg > images.txt
[user@server static]$ cat images.txt

[user@server static]$ ls *png >> images.txt
[user@server static]$ cat images.txt

[user@server static]$ ls *png > images.txt
[user@server static]$ cat images.txt

4.4:  Listing Specific Files

Use the wildcard asterisk * character to help specify bulk files when running UNIX commands. For example:

[user@server test1]$ ls *txt
file1.txt  file2.txt  sample-2.txt  special-list.txt  virtual-timing.txt
[user@server test1]$ ls *xml
reports.xml  survey.xml
[user@server test1]$ head -n1 *xml
==> reports.xml <==

==> survey.xml <==
<?xml version="1.0" encoding="UTF-8"?>
[user@server test1]$ rm *jpg
rm: cannot remove `*jpg': No such file or directory
[user@server test1]$ rm *log
rm: remove regular file `debug.log'? y
rm: remove regular file `survey.log'? y

Learn more: Globbing

  • War dieser Artikel hilfreich?