Can't run tmux in OS X Mavericks - osx-mavericks

Trying to run tmux on OS X Mavericks.
Here is my ~/.tmux.conf
# Keybindings
unbind c
unbind C-b
unbind C-a
unbind %
unbind ,
unbind .
unbind n
unbind p
unbind '"'
unbind l
unbind &
unbind "'"
# set-option -g prefix C-a # C-a for perfix just like screen
set -g prefix `
bind-key ` send-prefix
bind-key n new-window
bind-key C-a last-window
bind-key | split-window -h
bind-key \ split-window -h
bind-key - split-window -v
bind-key x kill-pane
bind-key X kill-window
# bind-key q confirm-before kill-session
bind-key q confirm-before kill-server
bind-key , previous-window # <
bind-key . next-window # >
bind-key < swap-window -t :-
bind-key > swap-window -t :+
# bind-key Escape copy-mode -u
# bind-key Up copy-mode -u
bind-key r source-file ~/.tmux.conf\; display-message " ✱ ~/.tmux.conf was reloaded"
bind-key R refresh-client
# bind-key a send-key C-a
# set status bar
set-option -g status-utf8 on
set-option -g status-bg colour232
set-option -g status-fg colour235
# set-option -g status-left '⣿'
# set-option -g status-right '⡇ #[bold]❐ #S:#I#[default] ⡇ #[bold]#(whoami) ● #H#[default] '
# set-option -g status-right '⡇ ❐ #S ⡇ ❖ #(rvm tools identifier) ⡇ #(whoami) ● #H '
set-option -g status-left '⣿'
set-option -g status-right '#(whoami) ● #H#[default] '
set-option -g status-right-length 60
set-option -g status-left-length 60
# highlight active window
set-window-option -g window-status-current-bg colour10
set-window-option -g window-status-current-fg colour234
I get the following error when I execute tmux:
/Users/levelone/.tmux.conf:2: unknown key: c [0/0]
/Users/levelone/.tmux.conf:3: unknown key: C-b
/Users/levelone/.tmux.conf:4: unknown key: C-a
/Users/levelone/.tmux.conf:5: unknown key: %
/Users/levelone/.tmux.conf:6: unknown key: ,
/Users/levelone/.tmux.conf:7: unknown key: .
/Users/levelone/.tmux.conf:8: unknown key: n
/Users/levelone/.tmux.conf:9: unknown key: p
/Users/levelone/.tmux.conf:10: unknown key: "
/Users/levelone/.tmux.conf:11: unknown key: l
/Users/levelone/.tmux.conf:12: unknown key: &
/Users/levelone/.tmux.conf:13: unknown key: '
/Users/levelone/.tmux.conf:16: bad key: `
/Users/levelone/.tmux.conf:17: unknown command: send-prefix
/Users/levelone/.tmux.conf:19: unknown command: new-window
/Users/levelone/.tmux.conf:20: unknown command: last-window
/Users/levelone/.tmux.conf:21: usage: split-window [-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] [-t target-pane] [command]
/Users/levelone/.tmux.conf:22: usage: split-window [-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] [-t target-pane] [command]
/Users/levelone/.tmux.conf:23: usage: split-window [-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] [-t target-pane] [command]
/Users/levelone/.tmux.conf:24: unknown command: kill-pane
/Users/levelone/.tmux.conf:25: unknown command: kill-window
/Users/levelone/.tmux.conf:35: unknown command: refresh-client
/Users/levelone/.tmux.conf:39: bad value: on
/Users/levelone/.tmux.conf:40: bad colour: colour232
/Users/levelone/.tmux.conf:41: bad colour: colour235
/Users/levelone/.tmux.conf:49: value is invalid: 60
/Users/levelone/.tmux.conf:50: value is invalid: 60
/Users/levelone/.tmux.conf:53: bad colour: colour10
/Users/levelone/.tmux.conf:54: bad colour: colour234
/Users/levelone/.tmux.conf:56: bad attributes: dim
/Users/levelone/.tmux.conf:60: bad value: off
/Users/levelone/.tmux.conf:61: bad value: on
/Users/levelone/.tmux.conf:62: bad value: on
/Users/levelone/.tmux.conf:65: bad value: on
/Users/levelone/.tmux.conf:67: bad value: off
/Users/levelone/.tmux.conf:69: bad attributes: normal
/Users/levelone/.tmux.conf:75: bad value: on
/Users/levelone/.tmux.conf:76: unknown value: vi
/Users/levelone/.tmux.conf:77: unknown value: on
/Users/levelone/.tmux.conf:84: bad colour: yellow
/Users/levelone/.tmux.conf:85: bad colour: white
/Users/levelone/.tmux.conf:88: value is invalid: 2000
/Users/levelone/.tmux.conf:92: unknown value: vi
/Users/levelone/.tmux.conf:93: usage: select-pane [-lDLRU] [-t target-pane]
/Users/levelone/.tmux.conf:94: usage: select-pane [-lDLRU] [-t target-pane]
/Users/levelone/.tmux.conf:95: usage: select-pane [-lDLRU] [-t target-pane]
/Users/levelone/.tmux.conf:96: usage: select-pane [-lDLRU] [-t target-pane]
/Users/levelone/.tmux.conf:102: unknown command: copy-mode
/Users/levelone/.tmux.conf:103: unknown command: paste-buffer
/Users/levelone/.tmux.conf:107: unknown command: begin-selection
/Users/levelone/.tmux.conf:119: value is invalid: 1

I suspect that your file has CR+LF line endings; tmux expects normal Unix-style LF-only line endings.
perl -pi -e 's/\r$//' ~/.tmux.conf

You may also use dosu2unix (available through MacPorts)

Related

greenplum6.9 gpexpand occurred error,but no error log

20201118:18:13:10:008884 gpexpand:master27:gpadmin-[INFO]:-Configuring new segments (primary)
20201118:18:13:10:008884 gpexpand:master27:gpadmin-[INFO]:-{'slave34': '/opt/data/gpdatap3/gpseg17:6002:true:false:19:17::-1:', 'slave33': '/opt/data/gpdatap3/gpseg16:6002:true:false:18:16::-1:', 'slave32': '/opt/data/gpdatap3/gpseg15:6002:true:false:17:15::-1:', 'slave31': '/opt/data/gpdatap3/gpseg14:6002:true:false:16:14::-1:', 'slave28': '/opt/data/gpdatap3/gpseg12:6002:true:false:14:12::-1:', 'slave29': '/opt/data/gpdatap3/gpseg13:6002:true:false:15:13::-1:'}
20201118:18:13:42:008884 gpexpand:master27:gpadmin-[ERROR]:-gpexpand failed: ExecutionError: 'Error Executing Command: ' occurred. Details: 'ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 slave33 ". /usr/local/greenplum-db-6.9.0/greenplum_path.sh; env GPSESSID=0000000000 GPERA=None $GPHOME/bin/pg_ctl -D /opt/data/gpdatap3/gpseg16 -l /opt/data/gpdatap3/gpseg16/pg_log/startup.log -w -t 600 -o \" -p 6002 -c gp_role=utility -M \" start 2>&1"' cmd had rc=1 completed=True halted=False
stdout='waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
'
stderr=''
Exiting...
20201118:18:13:42:008884 gpexpand:master27:gpadmin-[ERROR]:-Please run 'gpexpand -r' to rollback to the original state.
20201118:18:13:42:008884 gpexpand:master27:gpadmin-[INFO]:-Shutting down gpexpand...
Any help?
Thanks a lot

Using sed to print content of files in columns

I have an file , my file name is lookup.txt. Sometimes this file content is 100 lines , so everything scroll while printing. Thats why i like to print it on screen in 2 or more columns.
my bash doesnt support commands like pr or columns.Need to be in old fashion shell.
Content of lookup file is:
1-Top Scores
2-Last Scores
3-Username
4-Birthday
5-Last Meal today
6-Coronavirus in Italy
7-Lets Stay Home
8-Winner
9-Germany and Belgium
10-Alfa
11-Bravo
12-Charlie and delta
For printing in columns i use this command found here on stackoverflow:
cat lookup.txt | xargs printf '%-24s\n' | sed '$p;N;s/\n//;$p;N;s/\n//'
and this is the print in columns:
1-Top Scores 2-Last
Scores 3-Username 4-Birthday
5-Last Meal today
6-Coronavirus in Italy
7-Lets Stay Home
8-Winner 9-Germany and
Belgium 10-Alfa 11-Bravo
12-Charlie and delta
What i need is to let sed not split the words into different columns but just the line.
1-Top Scores 6-Coronavirus in Italy 11-Bravo
2-Last Scores 7-Lets Stay Home 12-Charlie and delta
3-Username 8-Winner
4-Birthday 9-Germany and Belgium
5-Last Meal today 10-Alfa
if the 3 columns are to width then x chars then print in 2 columns (this last is optional)
thanks in advance
Available tools:
/bin:
ash gunzip ping
base64 gzip ping6
bash hostname ps
bash.bash ionice ps.procps
busybox kill pwd
busybox.nosuid kill.procps rm
busybox.suid kmod rmdir
cat ln run-parts
chattr login sed
chgrp login.shadow setserial
chmod ls sh
chown lsattr sleep
cp lsmod stat
cttyhack lsmod.kmod stty
date mkdir su
dd mknod su.shadow
df mktemp sync
dmesg more tar
dnsdomainname mount touch
echo mount.util-linux true
editor mountpoint true.coreutils
egrep mountpoint.sysvinit umount
fake-hwclock mpstat uname
false mv usleep
false.coreutils netstat vi
fatattr nice vi.sh
fgrep pidof watch
getopt pidof.procps watch.procps
grep pidof.sysvinit zcat
/sbin:
arp ifup mkfs.ext4 runlevel.sysvinit
blkid init mkswap setconsole
blkid.util-linux init.sysvinit modinfo shutdown
bootlogd inotifyd modinfo.kmod shutdown.sysvinit
bridge insmod modprobe start-stop-daemon
depmod insmod.kmod modprobe.kmod stb-hwclock
depmod.kmod ip mount.cifs sulogin
devmem ip.iproute2 mount.fuse sulogin.util-linux
e2fsck iwconfig mount.ntfs swapoff
e2label iwgetid mount.ntfs-3g swapon
flock iwlist nologin switch_root
flock.util-linux iwpriv nologin.shadow sysctl
fsck.ext2 iwspy poweroff sysctl.procps
fsck.ext3 killall5 poweroff.sysvinit syslogd
fsck.ext4 klogd reboot telinit
fstab-decode ldconfig reboot.sysvinit tunctl
fstrim loadkmap rmmod tune2fs
getty logread rmmod.kmod udhcpc
halt losetup route uevent
halt.sysvinit lsmod routef vigr
hdparm mdev routel vigr.shadow
ifcfg mke2fs rtmon vipw
ifconfig mkfs.ext2 rtpr vipw.shadow
ifdown mkfs.ext3 runlevel
/usr/bin:
[ realpath
[[ renice
alsamixer reset
ar resize
awk rpcclient
basename rtmpdump
bdpoll scp
bsdcat scsi_logging_level
bunzip2 scsi_mandat
bzcat scsi_readcap
c_rehash scsi_ready
chage scsi_satl
cheetah scsi_start
cheetah-analyze scsi_stop
cheetah-compile scsi_temperature
chfn sdparm
chfn.shadow seq
chrt setsid
chsh sexp-conv
chsh.shadow sg
cifsdd sg_compare_and_write
clear sg_copy_results
cmp sg_dd
crontab sg_decode_sense
curl sg_emc_trespass
cut sg_format
dbclient sg_get_config
dbus-cleanup-sockets sg_get_lba_status
dbus-daemon sg_ident
dbus-launch sg_inq
dbus-monitor sg_logs
dbus-run-session sg_luns
dbus-send sg_map
dbus-update-activation-environment sg_map26
dbus-uuidgen sg_modes
dc sg_opcodes
diff sg_persist
dirname sg_prevent
dlist_test sg_raw
dos2unix sg_rbuf
dotlockfile sg_rdac
du sg_read
easy_install sg_read_attr
easy_install-2.7 sg_read_block_limits
eject sg_read_buffer
enigma2 sg_read_long
enigma2.sh sg_readcap
env sg_reassign
expiry sg_referrals
expr sg_rep_zones
faillog sg_requests
find sg_reset
flip sg_reset_wp
free sg_rmsn
free.procps sg_rtpg
fuser sg_safte
fusermount sg_sanitize
get_device sg_sat_identify
get_driver sg_sat_phy_event
get_module sg_sat_read_gplog
gpasswd sg_sat_set_features
grab sg_scan
groups sg_senddiag
groups.shadow sg_ses
gst-inspect-1.0 sg_ses_microcode
gst-launch-1.0 sg_start
gst-stats-1.0 sg_stpg
gst-typefind-1.0 sg_sync
head sg_test_rwbuf
hotplug_e2_helper sg_timestamp
id sg_turs
killall sg_unmap
last sg_verify
last.sysvinit sg_vpd
lastb sg_wr_mode
lastb.sysvinit sg_write_buffer
lastlog sg_write_long
ldbadd sg_write_same
ldbdel sg_write_verify
ldbedit sg_xcopy
ldbmodify sg_zone
ldbrename sginfo
ldbsearch sgm_dd
less sgp_dd
llmnrd sha1sum
lockfile-check sha256sum
lockfile-create sha3sum
lockfile-remove sha512sum
lockfile-touch shellinaboxd
logger showiframe
logname shuf
lsof skill
lspci skill.procps
lsusb slabtop
mail-lock smbcacls
mail-touchlock smbclient
mail-unlock smbcquotas
md5sum smbget
mesg smbspool
mesg.sysvinit smbtar
mid3cp smbtree
mid3iconv snice
mid3v2 snice.procps
mkfifo sort
moggsplit ssh
mutagen-inspect strings
mutagen-pony systool
nc tail
ndg_httpclient taskset
nettle-hash tee
nettle-lfib-stream telnet
nettle-pbkdf2 test
newgidmap time
newgrp timeout
newgrp.shadow tload
newuidmap toix
nmap toms
nohup top
nslookup top.procps
ntfs-3g tr
ntfs-3g.probe traceroute
ntpdate-sync traceroute6
od truncate
odhcp6c tty
ofgwrite ulockmgr_server
ofgwrite_bin uniq
ofgwrite_test unix2dos
openssl unlink
opkg unxz
opkg-check-config unzip
passwd update-alternatives
passwd.shadow uptime
patch uptime.procps
pgrep users
pgrep.procps utmpdump
pilconvert.py utmpdump.sysvinit
pildriver.py vlock
pilfile.py vmstat
pilfont.py volname
pilprint.py w
pkcs1-conv wall
pkill wall.sysvinit
pkill.procps wc
pmap wget
pmap.procps which
printf who
pwdx whoami
pwdx.procps whois
python wpa_passphrase
python-config xargs
python2 xmlcatalog
python2-config xmllint
python2.7 xzcat
python2.7-config yes
readlink
/usr/sbin:
addgroup grpconv pwck
adduser grpunconv pwconv
alsactl hddtemp pwunconv
automount i2cdetect rdate
avahi-daemon i2cdump rdev
chgpasswd i2cget readprofile
chpasswd i2cset rfkill
chpasswd.shadow ifplugd run-postinsts
chroot inetd setlogcons
crond logoutd sfdisk
delgroup mkfs.ubifs telnetd
deluser mtd_debug ubiattach
dropbear mtdinfo ubiblock
dropbearconvert mtdpart ubicrc32
dropbearkey nanddump ubidetach
dropbearmulti nandtest ubiformat
ether-wake nandwrite ubimkvol
ethtool newusers ubinfo
fbset nl-class-add ubinize
flash_erase nl-class-delete ubirename
flash_eraseall nl-class-list ubirmvol
flash_lock nl-classid-lookup ubirsvol
flash_otp_dump nl-cls-add ubiupdatevol
flash_otp_info nl-cls-delete unix_chkpwd
flash_otp_lock nl-cls-list unix_update
flash_otp_write nl-link-list update-ca-certificates
flash_unlock nl-pktloc-lookup update-rc.d
flashcp nl-qdisc-add useradd
ftpd nl-qdisc-delete userdel
genl-ctrl-list nl-qdisc-list usermod
groupadd ntpd vsftpd
groupdel ntpdate wpa_action
groupmems odhcp6c-update wpa_cli
groupmod parted wpa_supplicant
grpck partprobe
root#xp1000max:~#
Not claiming complete credit, you can modify this andlrc's answer on In bash how can I split a column in several column of fixed dimension to your requirement.
Instead of appending the columns with a whitespace, you can use sprintf() to custom print your column strings. Tested on GNU awk
awk '
BEGIN {
# Numbers of rows to print
n=5;
}
{
# Add to array with key = 0, 1, 2, 3, 4, 0, 1, 2, ..
l[(NR-1)%n] = sprintf("%s%-24s", l[(NR-1)%n], $0)
};
END {
# print the array
for (i = 0; i < length(l); i++) {
print l[i];
}
}
' file
Try this:
cat lookup.txt | tr '\n' '\0' | xargs -0 -n 2 printf '%-24s %-24s\n'
The tr command will convert newlines to nul chars.
Then we tell xargs to take nul-separated args and pass two at a time to the command.

Multiple Processes - Python

I am looking to run multiple instances of a command line script at the same time. I am new to this concept of "multi-threading" so am at bit of a loss as to why I am seeing the things that I am seeing.
I have tried to execute the sub-processing in two different ways:
1 - Using multiple calls of Popen without a communicate until the end:
command = 'raster2pgsql -I -C -e -s 26911 %s -t 100x100 -F p839.%s_image_sum_sum1 | psql -U david -d projects -h pg3' % (workspace + '\\r_sumsum1{}'.format(i), str(i))
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
command = 'raster2pgsql -I -C -e -s 26911 %s -t 100x100 -F p839.%s_image_sum_sum2 | psql -U david -d projects -h pg3' % (workspace + '\\r_sumsum2{}'.format(i), str(i))
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
command = 'raster2pgsql -I -C -e -s 26911 %s -t 100x100 -F p839.%s_image_sum_sum3 | psql -U david -d projects -h pg3' % (workspace + '\\r_sumsum3{}'.format(i), str(i))
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(stdoutdata, stderrdata) = process.communicate()
this starts up each of the command line item but only completes the last entry leaving the other 2 hanging.
2 - Attempting to implement an example from Python threading multiple bash subprocesses? but nothing happens except for a printout of the commands (program hangs with no command line arguments running as observed in windows task manager:
import threading
import Queue
import commands
import time
workspace = r'F:\Processing\SM'
image = 't08r_e'
image_name = (image.split('.'))[0]
i = 0
process_image_tif = workspace + '\\{}{}.tif'.format((image.split('r'))[0], str(i))
# thread class to run a command
class ExampleThread(threading.Thread):
def __init__(self, cmd, queue):
threading.Thread.__init__(self)
self.cmd = cmd
self.queue = queue
def run(self):
# execute the command, queue the result
(status, output) = commands.getstatusoutput(self.cmd)
self.queue.put((self.cmd, output, status))
# queue where results are placed
result_queue = Queue.Queue()
# define the commands to be run in parallel, run them
cmds = ['raster2pgsql -I -C -e -s 26911 %s -t 100x100 -F p839.%s_image_sum_sum1 | psql -U david -d projects -h pg3' % (workspace + '\\r_sumsum1{}'.format(i), str(i)),
'raster2pgsql -I -C -e -s 26911 %s -t 100x100 -F p839.%s_image_sum_sum2 | psql -U david -d projects -h pg3' % (workspace + '\\r_sumsum2{}'.format(i), str(i)),
'raster2pgsql -I -C -e -s 26911 %s -t 100x100 -F p839.%s_image_sum_sum3 | psql -U david -d projects -h pg3' % (workspace + '\\r_sumsum3{}'.format(i), str(i)),
]
for cmd in cmds:
thread = ExampleThread(cmd, result_queue)
thread.start()
# print results as we get them
while threading.active_count() > 1 or not result_queue.empty():
while not result_queue.empty():
(cmd, output, status) = result_queue.get()
print(cmd)
print(output)
How can I run all of these commands at the same time achieving a result at the end? I am running in windows, pyhton 2.7.
My first try didn't work because of the repeated definitions of stdout and sterror. Removing these definitions causes expected behavior.

Error while running xterm in telnet script

This is error while running the telnet script.
Language: Shell script
Error:
Type xterm -help for a full description.
xterm: Explicit shell already was /root/Desktop/stage2/./close_telnet.sh
xterm: bad command line option "192.168.0.1 25"
usage: xterm [-/+132] [-C] [-Sccn] [-T string] [-/+ah] [-/+ai] [-/+aw]
[-b number] [-/+bc] [-bcf milliseconds] [-bcn milliseconds] [-bd color]
[-/+bdc] [-bg color] [-bw number] [-/+cb] [-cc classrange] [-/+cjk_width]
[-class string] [-/+cm] [-/+cn] [-cr color] [-/+cu] [-/+dc]
[-display displayname] [-e command args ...] [-fa pattern] [-fb fontname]
[-/+fbb] [-/+fbx] [-fd pattern] [-fg color] [-fi fontname] [-fn fontname]
[-fs size] [-/+fullscreen] [-fw fontname] [-fwb fontname] [-fx fontname]
[%geom] [#geom] [-geometry geom] [-help] [-/+hm] [-/+hold] [-iconic]
[-/+ie] [-/+im] [-into windowId] [-/+j] [-/+k8] [-kt keyboardtype] [-/+l]
[-/+lc] [-lcc path] [-leftbar] [-lf filename] [-/+ls] [-/+maximized]
[-/+mb] [-mc milliseconds] [-/+mesg] [-/+mk_width] [-ms color] [-n string]
[-name string] [-nb number] [-/+nul] [-/+pc] [-/+pob] [-report-colors]
[-report-fonts] [-rightbar] [-/+rv] [-/+rvc] [-/+rw] [-/+s] [-/+samename]
[-/+sb] [-selbg color] [-selfg color] [-/+sf] [-sh number] [-/+si] [-/+sk]
[-sl number] [-/+sm] [-/+sp] [-/+t] [-ti termid] [-title string]
[-tm string] [-tn name] [-/+u8] [-/+uc] [-/+ulc] [-/+ulit] [-/+ut] [-/+vb]
[-version] [-/+wc] [-/+wf] [-xrm resourcestring] [-ziconbeep percent]
Type xterm -help for a full desc
Please suggest any idea to solve this error.
The likely problem is that $window_id is an empty value. That would produce the error message from xterm.
In a quick check, I have the output from wmctrl -lp as
$ wmctrl -lp
0x00400023 0 1036 localhost.localdomain [!./bar] - vile
0x00a0000a 0 3981 localhost.localdomain xclock xclock
but the output of the expression with xprop is 0x0400023 (a different number of leading zeros).
If I change the fragment
awk '{print $5}' | sed 's/,//' | sed 's/^0x/0x0/'
to
awk '{sub(",","",$5);printf("%#010x",$5);}'
it gives a usable result (for my machine: ymmv).

calling command with some arguments works but not with others but works from console

The following code works and outputs details of 10 processes.
package main
import (
"os/exec"
)
func main() {
print(top())
}
func top() string {
app := "/usr/bin/top"
cmd := exec.Command(app, "-n 10", "-l 2")
out, err := cmd.CombinedOutput()
if err != nil {
return err.Error() + " " + string(out)
}
value := string(out)
return value
}
However, when I try the same with an additional argument of "-o cpu" (e.g. cmd := exec.Command(app, "-o cpu", "-n 10", "-l 2")). I get the following error.
exit status 1 invalid argument -o: cpu
/usr/bin/top usage: /usr/bin/top
[-a | -d | -e | -c <mode>]
[-F | -f]
[-h]
[-i <interval>]
[-l <samples>]
[-ncols <columns>]
[-o <key>] [-O <secondaryKey>]
[-R | -r]
[-S]
[-s <delay>]
[-n <nprocs>]
[-stats <key(s)>]
[-pid <processid>]
[-user <username>]
[-U <username>]
[-u]
But the command "top -o cpu -n 10 -l 2" from my console works fine. Also I'm using OS X 10.9.3.
Separate your arguments.
top -o cpu -n 10 -l 2 is not what you are executing. What you're passing as arguments to the command is equivalent to using top "-o cpu" "-n 10" "-l 2" in a shell (which if you try, it will give you the exact same output).
Most commands will strictly parse that as 3 arguments. Since POSIX arguments don't require a space, top splits off the -o as the first option, and uses the rest as its argument. This works for the numerical arguments mostly by accident, but the for -o it looks for a field named " cpu", which there isn't.
Instead, use
exec.Command(app, "-o", "cpu", "-n", "10", "-l", "2")

Resources