Questions tagged [command-line]
Using programs and commands that do not have a graphical user interface (GUI) but are rather controlled by typing text commands into a terminal program, or shell.
3,149
questions
0
votes
2
answers
738
views
list files by date added in terminal with function or script or another
I found this in another post but would like to be able to call a script of function to reduce the amount of typing.
ls -a | \
grep -v '^\.$\|^\.\.$' | \
xargs -I {} mdls -name kMDItemFSName -name ...
0
votes
1
answer
720
views
Equivalent of objcopy -0 binary for Mach-O object files in macOS?
Equivalent of objcopy -O binary <FILE> <FILE>.bin for Mach-O object files in macOS?
I want to dump the executable code in the __TEXT segment to a flat binary file on macOS.
This can be ...
0
votes
1
answer
976
views
Unable to open a UDP port with nc
On ubuntu, I can open a UDP port:
nc -lu 5555
Then in another terminal window, send a message:
echo "hello" | nc -u localhost 5555
The message is received at the listener side, as expected.
...
0
votes
1
answer
298
views
How can I download files from Linux to macOS only using the existing SSH connection?
How can I download files from Linux to my Mac OS using only the existing ssh connection?
I know if I use the Windows System, I can use lrzsz to down files:
yum install lrzsz
sz file // there can ...
0
votes
1
answer
171
views
result returns just new line \n not whats printed after command is run
Ultimately I'm trying to catch some errors that are popping up but aren't getting returned.
Here's the command I'm trying to run.
/usr/bin/dscl . -change /Users/admin NFSHomeDirectory /Users/admin ...
0
votes
1
answer
1k
views
How to make `sudo su` run startup scripts?
Supposedly the bin/sh shell that is the default root shell is not strictly a "bash" shell, but is a POSIX compliant equivalent. According to this site, when you invoke the shell executable of a "...
0
votes
1
answer
602
views
How to activate Recoverit when 'csrutil' doesn't *on macbk pro 10.13.6
Terminal messaged 'failed to modify system integrity configuration. This tool needs to be executed from the Recovery OS.' Where is Recovery OS.Objective to recover data from Emptied Trash...precious ...
0
votes
1
answer
1k
views
How to read mail via command on Mac?
I set my mail agent tool to send and to receive mails with many accounts such as a gmail account.
I want to read the mail via command line for triggering cronjob purpose.
For example, | grep "...
0
votes
1
answer
476
views
Network proxy setup in terminal
I am trying to create a bash script that will update the mac's proxy settings and a few other places when a user changes their password every 60 days. So far I am trying to use this command for the ...
0
votes
1
answer
41
views
What is this title in the watch command? android-
Running the watch command I see this title:
Every 2.0s: ls android-94348784d7dfd533: Mon Feb 4 08:59:54 2019
The android portion is confusing me. I don't understand what it is ...
0
votes
1
answer
54
views
Modifying `whatis` to return error code for missing commands
Followup to "whatis" returns 0 for missing commands, I am trying to modify /usr/bin/whatis to return a non-zero exit code after an inappropriate command has been entered. My approach to ...
0
votes
1
answer
1k
views
How to get the Disk Image property using terminal?
Let's say I have the volume path.
Normally I can right-click and 'Get info' to get its Disk image.
I want to replicate the same on terminal (basically need to code it in objective C)
mdls doesn't seem ...
0
votes
1
answer
71
views
Why isn't xargs running one command per line for this use case?
My overall task is to ping each EC2 server I happen to be connected to.
I am using this command to do that:
netstat -W | grep ec2 | cut -d " " -f 18 | sort -u | cut -d "." -f 1,2,3,4 | xargs -0 -p "...
0
votes
1
answer
426
views
bsdtar gives (Empty error message) when trying to extract an ISO
On High Sierra 10.13.6 (17G65), trying to bsdtar -xf something.iso fails with:
bsdtar: (Empty error message)
bsdtar: Error exit delayed from previous errors.
I have plenty of disk space left and ...
0
votes
1
answer
2k
views
Atom editor no longer opens from command line
I've been using the Atom editor on my iMac running High Sierra. I usually run it from the terminal by typing atom. I moved many of my apps to an external drive to free up disk space. I originally ...
0
votes
2
answers
354
views
How to list all /dev/disks, not partitions ending in s1, s2, ...?
I am trying to list (output) the drive its Mac OS X name from the serial number in the Bash 3.2 shell on the command line. For this I need to loop through all block devices not being a partition. So I ...
0
votes
1
answer
2k
views
dd error: unknown conversion sync
I have an external drive with multiple partitions. I want to clone the entire drive. There are not any GUI apps that I can find that will clone the entire volume, so I attempted dd. My command was:...
0
votes
1
answer
67
views
How to access folder form a .tool application
I can create a clickable script, by changing the .sh extension to a .tool (or .command) one. However when I do this, the paths that I have in my script break.
I am trying to run a dotnet core ...
0
votes
1
answer
630
views
How to install a virtual environment of Python in macOS
First steps with Python, I am trying to run Python in a virtual environment in macOS.
I Googled "install virtual environment python mac" and got a link for this.
When I typed in Terminal:
$ pip ...
0
votes
1
answer
1k
views
/usr/bin/open executable disappeared
I am on macOS High Sierra (Version 10.13.3) all recent updates are installed.
The open executable is not in the /usr/bin folder anymore.
Is there anyway to repair the system so that I can get it ...
0
votes
1
answer
57
views
How to remove /volumes/ from my automator service using existing shell script
I have this shell script from here. Right now it outputs something like this:
File Path: afp://serveraddress.com/Volumes/Sharepoint/Folder/test.txt Parent Folder: afp://serveraddress.com/Volumes/...
0
votes
2
answers
461
views
bash prompt acting weird when I click UP key and then down KEY
So my bash prompt looks like this [parth:~]$ and if I go cd to Desktop, it looks like this [parth:Desktop]$. I only want to see the current directory, next to my username so if I go to a folder, in ...
0
votes
2
answers
556
views
Have installed “Command line” but whenever i try to build and run my program terminal says “No such file or directory”
I have tried to build and run my project through CodeLite.
I have installed Command Line but somehow it doesn't work.
It says "no such file or directory"
but whenever I ask it to look for gcc, it ...
0
votes
1
answer
929
views
How to start with launchd a bash script that calls fswatch with `&`
Manually it works
I have a bash script called git-watch.sh (gist link) that calls fswatch in a loop like this:
while read -r line; do
{
fswatch -r "$line" | grep --line-buffered -v '.git' | ...
0
votes
1
answer
472
views
How can I "Quick Look" (result of pressing Space Bar in Finder) a filename printed by "ls" in iTerm2?
Simple question: is it possible to get the "Quick Look" of images and text files by clicking the results of ls in an iTerm2 window?
0
votes
1
answer
823
views
SH script calls Perl script. Works when I double click, but Perl script fails when I call from terminal
Severe newb here. I have a shell script that simply calls a perl script to create a file. It works if I double-click the SH file, but fails if I call the file in a terminal. here is the entire SH ...
0
votes
1
answer
899
views
Open a terminal tab at a specified directory from command line
I am looking for a script-based solution executed in the command line.
Open a new window of terminal at specified ~/desktop
open -na terminal ~/desktop
Open a terminal tab
osascript -e 'tell ...
0
votes
1
answer
106
views
security cms for S/MIME?
Can I use
security cms
for encrypting and decrypting S/MIME mails? Or is there any alternative?
0
votes
1
answer
2k
views
Equivalent of Linux "service" command on Mac OS to stop a running process/service
I want to stop a running driver on Mac OS then overwrite it with another version then restart. The files are overwritten to the same location.
When I overwrite and reboot the new driver starts as ...
0
votes
1
answer
489
views
Recursively change file type
I have folders, containing files and folders.
Among these files, some have extension, some have no extension.
I noticed that a file without extension can have a type (probably stored in some kind of ...
0
votes
1
answer
94
views
Is there a command line utility to perform common Wi-Fi operations?
I would like to manage my Mac's Wi-Fi on the command line, but there are lots of different built-in Mac utilities that need to be called (airport, ipconfig, networksetup, netstat, security), with ...
0
votes
1
answer
2k
views
Change accessibility setting on Mac for command line program
I have built a simple command line program with Xcode, and I would like to access the NSEvent.addGlobalMonitorForEvents method.
It seems like the program must be trusted for this to work.
self....
0
votes
1
answer
967
views
Detect fn and function key simultaneously pressed
I am using ControllerMate to try to change what my volume buttons do.
Unfortunately, I haven't figured out how I can detect that the F11 or F12 keys are being pressed at the same time as the fn key.
...
0
votes
1
answer
572
views
/etc/profile not being sourced for login shells
The -l flag to sh is supposed to source the contents of /etc/profile and other profile scripts like ~/.profile, which generally provide the initial set of environment variables for a login session.
...
0
votes
1
answer
174
views
Decode MacBook assembly date from system report file?
My task is to create a simple database containing information about the MacBooks my company owns. In order not to do it manually, I decided to ask everyone using a Mac to send me a system report file ...
0
votes
1
answer
73
views
Text file line order messed up in terminal
I was writing a simple bash script for a small task.
echo starting
URL="10.10.0.1/api/monitoring/traffic-statistics"
curl -b cookie $URL
When I executed it using bash script.sh , it just prints ...
0
votes
1
answer
802
views
Run Xcode `git pull` and `git Push` commands in terminal
The question is clear:
How do I perform Xcode's commands for git pull and git push via terminal?
Reason:
I've set up multiple git accounts and ssh (Reference). Someone told me the reason why one of ...
0
votes
2
answers
565
views
`dd`command: ISO to USB Changes Partition Table to APM
I am trying to dd an ISO to a USB so I can install Linux on another computer, but the USB changes from any partition table (GPM or MBR) to APM when it finishes.
I'm using the following command:
sudo ...
0
votes
1
answer
22
views
Cannot get duplication of screens to work with mini display between iMac & Macbook
Have an iMac 21", 2.5, Mid 2011 and a MacBook Pro Mid 2012 and I just bought a Mini display to connect them through the Thunderbolt. I cannot see that they are connected or the choice to connect it in ...
0
votes
1
answer
452
views
how to use hpn ssh with sftp command
I've installed hpn ssh using this command:
sudo port install openssh +hpn
I want to transfer lost data (100GB at least) using sftp command terminal command.
I am wondering, is installing hpn ssh ...
0
votes
1
answer
419
views
Issue when trying to convert the month number to word form in AppleScript (but only when that month contains 31 days)
I have a piece of AppleScript code that converts a numerical date to that date in words.
The code accepts a variable that contains a date in the following format:
2017_04_01
The code converts ...
0
votes
1
answer
2k
views
Trying to script partitioning Macintosh HD in command line?
I am trying to script partitioning the Macintosh HD. I am running
diskutil partitionDisk /dev/disk0 GPT JHFS+ New 100g
in command line and I'm getting this error.
Started partitioning on disk0
...
0
votes
1
answer
360
views
How does this AWK script work?
I have 2 data files each containing one column.
I want to make another data file by merging both the columns.
I have the command line in shell but I don't know how it works.
Please explain ...
0
votes
1
answer
203
views
check if storage is available and if it is execute a backup routine with passwordphrase
i installed restic backup program with homebrew and tested its performance. Its great. So i wold like to set up a automated routine.
I tried to do it in automator with a workflow but because of the ...
0
votes
1
answer
2k
views
Which `vboxmanage clonehd` variant corresponds to the GUI selection `dynamically allocated`?
I wanted to resize a VMDK, which VBoxManage can't resize directly, so I used the Convert to VDI → Resize VDI → Convert to VMDK procedure described here.
For the last step, I could not find clear ...
0
votes
1
answer
173
views
.cshrc got empitied, aliases are loaded in opened terminal, how to retrieve them?
accidentally my .cshrc file got deleted, which had many aliases. I have terminal tab opened in my linux machine, which has all these aliases loaded in it. How can i retrieve it so that i could write ...
0
votes
2
answers
1k
views
What steps can be taken to recover from rm -rf ~
Asking for a friend.
Imagine that one has accidentally created a file named ~ and in the process of deleting it, foolishly types:
rm -rf ~
Luckily, I have active terminal windows open, so all is ...
0
votes
1
answer
460
views
How do I save terminal output to a file?
How do I save the output of a command to a file from terminal?
That is if my command gives some output and it is printed directly on terminal but I want it in some text file or may be other kind of ...
0
votes
1
answer
572
views
AppleScript / Shell Script to read 'curl -L' data
I have Dropbox file with two lines of data that I'd like to parse into two variables. The following function should have the right logic but doesn't seem to work:
set versionFile to do shell script ("...
0
votes
2
answers
46
views
About Mac histories of programs?
My friend asked me a question about "Is it possible to check what programs you open and you made" and I didn't know if its possible or not so I want to ask you if its possible or not.
Like how can ...